aboutsummaryrefslogtreecommitdiff
path: root/miniMAL/core.json
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-02-15 22:04:45 -0600
committerJoel Martin <github@martintribe.org>2015-02-15 22:04:45 -0600
commitf618f6a11c661a74e5805a75b51815a0cafebaaf (patch)
tree4bb059e6346da66336783d12a69c9e162a497097 /miniMAL/core.json
parent1981bf5766d9bb75a652cc781b817cc3150d12ef (diff)
downloadmal-f618f6a11c661a74e5805a75b51815a0cafebaaf.tar.gz
mal-f618f6a11c661a74e5805a75b51815a0cafebaaf.zip
miniMAL: step8.
Diffstat (limited to 'miniMAL/core.json')
-rw-r--r--miniMAL/core.json13
1 files changed, 13 insertions, 0 deletions
diff --git a/miniMAL/core.json b/miniMAL/core.json
index a1549db..a5c44bd 100644
--- a/miniMAL/core.json
+++ b/miniMAL/core.json
@@ -7,6 +7,16 @@
0,
["count", "a"]]]],
+["def", "_nth", ["fn", ["seq", "idx"],
+ ["if", [">=", "idx", ["count", "seq"]],
+ ["throw", "nth: index out of range"],
+ ["nth", "seq", "idx"]]]],
+
+["def", "_first", ["fn", ["seq"],
+ ["if", ["empty?", "seq"],
+ null,
+ ["first", "seq"]]]],
+
["def", "core-ns",
["hash-map",
["`", "="], "equal?",
@@ -38,6 +48,9 @@
["`", "cons"], "cons",
["`", "concat"], "concat",
+ ["`", "nth"], "_nth",
+ ["`", "first"], "_first",
+ ["`", "rest"], ["fn", ["a"], ["rest", "a"]],
["`", "empty?"], "empty?",
["`", "count"], "_count"]],