diff --git a/DEVELOP.md b/DEVELOP.md index 534426d..009e6f2 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -54,6 +54,23 @@ simple | END | STDERRREDIRECT ; + +type : typeItem ('|' typeItem)* ; + +typeItem + : 'int' + | 'float' + | 'string' + | 'bool' + | typeList + | typeQuote + | genericType + ; + +typeQuote : '(' type* -- type* ')' ; +typeList : homogeneousList | heterogeneousList ; +homogeneousList : '[' type '*' ']' ; +heterogeneousList : '[' type+ ']' ; ``` Key Types: @@ -65,7 +82,7 @@ MShellObject MShellBool MShellQuotation MShellString - + MShellFloat ``` ## References diff --git a/lib/std.msh b/lib/std.msh index 18841d7..f34f26f 100644 --- a/lib/std.msh +++ b/lib/std.msh @@ -1,5 +1,7 @@ # Standard library for mshell +type numeric int | float + # each (list quote: (item --) --) def each over len each-len! # Get total length @@ -19,6 +21,12 @@ end # map (list quote -- list) def map +( + [T*]: list + (T -- U): q + -- + [U*] +) over len map-len! # Get total length 0 map-idx! # Index [] map-accum! # Accumulator