mirror of
https://github.com/kanaka/mal.git
synced 2024-08-16 17:20:23 +03:00
core list functions
This commit is contained in:
parent
2c68746267
commit
643e6f4f3c
@ -28,6 +28,27 @@ val coreMath = [
|
||||
| _ => raise NotApplicable "'/' requires arguments")
|
||||
]
|
||||
|
||||
val coreList = [
|
||||
SYMBOL "list",
|
||||
FN (fn args => LIST args),
|
||||
|
||||
SYMBOL "list?",
|
||||
FN (fn [LIST _] => BOOL true
|
||||
| [_] => BOOL false
|
||||
| _ => raise NotApplicable "list? requires one argument"),
|
||||
|
||||
SYMBOL "empty?",
|
||||
FN (fn [LIST []] => BOOL true
|
||||
| [LIST _] => BOOL false
|
||||
| _ => raise NotApplicable "empty? requires a list"),
|
||||
|
||||
SYMBOL "count",
|
||||
FN (fn [LIST l] => INT (length l)
|
||||
| _ => raise NotApplicable "count requires a list")
|
||||
]
|
||||
|
||||
|
||||
val coreNs = List.concat [
|
||||
coreList,
|
||||
coreMath
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user