Skip to content

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchpaulus committed Dec 13, 2024
1 parent 393cc28 commit 59a1c8e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
19 changes: 18 additions & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -65,7 +82,7 @@ MShellObject
MShellBool
MShellQuotation
MShellString
MShellFloat
```

## References
Expand Down
8 changes: 8 additions & 0 deletions lib/std.msh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 59a1c8e

Please sign in to comment.