1
1
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:
Fabian 2021-03-27 13:31:42 +01:00 committed by Joel Martin
parent 2c68746267
commit 643e6f4f3c

View File

@ -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
]