mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
MAINT: Cleanup the syntax of some of the stdlib after parsing improvements.
This commit is contained in:
parent
87e5db7dbf
commit
de97109681
@ -46,10 +46,10 @@ let enumerate = module{
|
||||
list=acc.list + [[acc.count, item]],
|
||||
};
|
||||
|
||||
let acc = {count=mod.start, list=[], step=mod.step};
|
||||
|
||||
let enumerated = reduce(reducer, acc, (mod.list));
|
||||
let result = enumerated.list;
|
||||
let result = reduce(
|
||||
reducer,
|
||||
{count=mod.start, list=[], step=mod.step},
|
||||
(mod.list)).list;
|
||||
};
|
||||
|
||||
// zips two lists together.
|
||||
|
@ -48,7 +48,9 @@ let any = module {
|
||||
// source value and must be of the same base type and shape. This module will
|
||||
// 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
|
||||
// nor we check that they output the same types.
|
||||
let shaped = module {
|
||||
@ -66,7 +68,7 @@ let shaped = module {
|
||||
} => {
|
||||
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{
|
||||
ok = select (name) in acc.shape, mod.partial, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user