MAINT: Cleanup the syntax of some of the stdlib after parsing improvements.

This commit is contained in:
Jeremy Wall 2019-02-18 20:15:54 -06:00
parent 87e5db7dbf
commit de97109681
2 changed files with 8 additions and 6 deletions

View File

@ -46,10 +46,10 @@ let enumerate = module{
list=acc.list + [[acc.count, item]], list=acc.list + [[acc.count, item]],
}; };
let acc = {count=mod.start, list=[], step=mod.step}; let result = reduce(
reducer,
let enumerated = reduce(reducer, acc, (mod.list)); {count=mod.start, list=[], step=mod.step},
let result = enumerated.list; (mod.list)).list;
}; };
// zips two lists together. // zips two lists together.

View File

@ -48,7 +48,9 @@ let any = module {
// source value and must be of the same base type and shape. This module will // source value and must be of the same base type and shape. This module will
// recurse into nested tuples. // recurse into nested tuples.
// //
// Lists are assumed to be able to contain any type and can be any length. // Lists are must contain types from the list shape they are compared against.
// and empty list shape means the list val can have any types it wants inside.
//
// We do not check that functions or modules have the same argument lengths or types // We do not check that functions or modules have the same argument lengths or types
// nor we check that they output the same types. // nor we check that they output the same types.
let shaped = module { let shaped = module {
@ -66,7 +68,7 @@ let shaped = module {
} => { } => {
let schema = import "std/schema.ucg"; let schema = import "std/schema.ucg";
let simple_handler = func (val, shape) => val is (schema.base_type_of(shape)); let simple_handler = func (val, shape) => val is schema.base_type_of(shape);
let tuple_handler = func (acc, name, value) => acc{ let tuple_handler = func (acc, name, value) => acc{
ok = select (name) in acc.shape, mod.partial, { ok = select (name) in acc.shape, mod.partial, {