From 59a1c8ea123f6a100a44cdbfaf746661db5b0a6e Mon Sep 17 00:00:00 2001 From: Mitchell Paulus Date: Fri, 13 Dec 2024 17:01:43 -0600 Subject: [PATCH] TMP --- DEVELOP.md | 19 ++++++++++++++++++- lib/std.msh | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) 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