diff --git a/std/functional.ucg b/std/functional.ucg index c7a64f1..ba86bb3 100644 --- a/std/functional.ucg +++ b/std/functional.ucg @@ -16,14 +16,14 @@ let maybe = module{ val = NULL, } => ({do=do, is_null=is_null, or=or, unwrap=unwrap, expect=expect}) { - let maybe = mod.pkg().maybe; + let this = mod.this; - let do = func (op) => select (mod.val != NULL), maybe{val=NULL}, { - true = maybe{val=op(mod.val)}, + let do = func (op) => select (mod.val != NULL), this{val=NULL}, { + true = this{val=op(mod.val)}, }; - let or = func (op) => select (mod.val == NULL), maybe{val=mod.val}, { - true = maybe{val=op()}, + let or = func (op) => select (mod.val == NULL), this{val=mod.val}, { + true = this{val=op()}, }; let is_null = func() => mod.val == NULL; diff --git a/std/lists.ucg b/std/lists.ucg index 74e61fb..93f7f85 100644 --- a/std/lists.ucg +++ b/std/lists.ucg @@ -169,14 +169,14 @@ let ops = module{ reverse=reverse, list=list, }) { - let super = mod.pkg(); + let pkg = mod.pkg(); let list = mod.list; - let len = super.len(mod.list); - let str_join = func(sep) => super.str_join{list=mod.list, sep=sep}; + let len = pkg.len(mod.list); + let str_join = func(sep) => pkg.str_join{list=mod.list, sep=sep}; - let slice = func(start, end) => super.slice{start=start, end=end, list=mod.list}; - let enumerate = func() => super.ops{list=super.enumerate{start=0, step=1, list=mod.list}}; - let tail = func() => super.ops{list=super.tail(mod.list)}; - let head = func() => super.head(mod.list); - let reverse = func() => super.ops{list=super.reverse(mod.list)}; + let slice = func(start, end) => pkg.slice{start=start, end=end, list=mod.list}; + let enumerate = func() => pkg.ops{list=pkg.enumerate{start=0, step=1, list=mod.list}}; + let tail = func() => pkg.ops{list=pkg.tail(mod.list)}; + let head = func() => pkg.head(mod.list); + let reverse = func() => mod.this{list=pkg.reverse(mod.list)}; }; \ No newline at end of file diff --git a/std/schema.ucg b/std/schema.ucg index 951e267..c000e39 100644 --- a/std/schema.ucg +++ b/std/schema.ucg @@ -92,18 +92,19 @@ let shaped = module { partial = true, } => (result) { let schema = mod.pkg(); + let this = mod.this; let simple_handler = func (val, shape) => val is schema.base_type_of(shape); let tuple_handler = func (acc, name, value) => acc{ ok = select (name) in acc.shape, mod.partial, { - true = schema.shaped{val=value, shape=acc.shape.(name), partial=mod.partial}, + true = this{val=value, shape=acc.shape.(name), partial=mod.partial}, }, }; let shape_tuple_handler = func (acc, field_name, value) => acc{ ok = select (field_name) in acc.val, false, { - true = schema.shaped{val=value, shape=acc.val.(field_name), partial=false}, + true = this{val=value, shape=acc.val.(field_name), partial=false}, }, }; @@ -117,7 +118,7 @@ let shaped = module { ok = acc.ok && schema.any{val=value, types=acc.shape}, }; - let result =select schema.base_type_of(mod.val), false, { + let result = select schema.base_type_of(mod.val), false, { str = simple_handler(mod.val, mod.shape), int = simple_handler(mod.val, mod.shape), float = simple_handler(mod.val, mod.shape), diff --git a/std/strings.ucg b/std/strings.ucg index cdbbcec..8dd17c0 100644 --- a/std/strings.ucg +++ b/std/strings.ucg @@ -65,14 +65,14 @@ let ops = module { start = 0, end = len, } => (result) { - let filepkg = mod.pkg(); + let pkg = mod.pkg(); let reducer = func(acc, char) => acc{ counter = acc.counter + 1, str = select ((acc.counter >= mod.start) && (acc.counter <= mod.end)), acc.str, { true = acc.str + char, }, }; - let result = filepkg.ops{str=reduce( + let result = pkg.ops{str=reduce( reducer, {counter = 0, str = ""}, mod.str).str}; }; }; \ No newline at end of file diff --git a/std/tuples.ucg b/std/tuples.ucg index bc1e17e..2fd404a 100644 --- a/std/tuples.ucg +++ b/std/tuples.ucg @@ -48,11 +48,11 @@ let ops = module{ } => ({fields=fields, values=values, iter=iter}) { (mod.tpl != NULL) || fail "tpl must not be null"; - let super = mod.pkg(); + let pkg = mod.pkg(); - let fields = func() => super.fields{tpl=mod.tpl}; - let values = func() => super.values{tpl=mod.tpl}; - let iter = func() => super.iter{tpl=mod.tpl}; + let fields = func() => pkg.fields{tpl=mod.tpl}; + let values = func() => pkg.values{tpl=mod.tpl}; + let iter = func() => pkg.iter{tpl=mod.tpl}; }; // Strip all the null fields from a tuple. @@ -71,11 +71,11 @@ let has_fields = module{ tpl = NULL, fields = [], } => (result) { - let lib = mod.pkg(); + let pkg = mod.pkg(); // First we check that mod.tpl is a tuple. - lib.assert_tuple(mod.tpl); + pkg.assert_tuple(mod.tpl); - let fs = lib.fields{tpl=mod.tpl}; + let fs = pkg.fields{tpl=mod.tpl}; let result = reduce(func (acc, f) => acc && (f in fs), true, mod.fields); }; @@ -86,9 +86,9 @@ let field_type = module{ field = NULL, type = NULL, } => (result) { - let lib = mod.pkg(); + let pkg = mod.pkg(); // First we check that mod.tpl is a tuple. - lib.assert_tuple(mod.tpl); + pkg.assert_tuple(mod.tpl); // Next we assert that mod.field is a string. select mod.field is "str", NULL, { @@ -101,7 +101,7 @@ let field_type = module{ }; // Get the list of field value pairs. - let it = lib.iter{tpl=mod.tpl}; + let it = pkg.iter{tpl=mod.tpl}; // The reducer function used to check the field's types if it exists. let reducer = func (acc, l) => acc && (select l.0 == mod.field, NULL, { @@ -110,5 +110,5 @@ let field_type = module{ }); // The computed answer true or false. - let result = lib.has_fields{tpl=mod.tpl, fields=[mod.field]} && reduce(reducer, true, it); + let result = pkg.has_fields{tpl=mod.tpl, fields=[mod.field]} && reduce(reducer, true, it); };