aboutsummaryrefslogtreecommitdiff
path: root/miniMAL/core.json
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-02-16 00:33:30 -0600
committerJoel Martin <github@martintribe.org>2015-02-16 00:33:30 -0600
commit320455465294f170f54cda772142f4de4cb6f602 (patch)
tree43c99b1539f192954f1f7ff18fed2b132c191431 /miniMAL/core.json
parentd90c784472f6131f28612eb6eaa02404e002178d (diff)
downloadmal-320455465294f170f54cda772142f4de4cb6f602.tar.gz
mal-320455465294f170f54cda772142f4de4cb6f602.zip
miniMAL: keyword, vector and hash-map support.
Diffstat (limited to 'miniMAL/core.json')
-rw-r--r--miniMAL/core.json37
1 files changed, 34 insertions, 3 deletions
diff --git a/miniMAL/core.json b/miniMAL/core.json
index e61000d..cec9156 100644
--- a/miniMAL/core.json
+++ b/miniMAL/core.json
@@ -11,6 +11,24 @@
["def", "time-ms", ["fn", [],
[".", ["new", "Date"], ["`", "getTime"]]]],
+
+["def", "assoc", ["fn", ["src-hm", "&", "kvs"],
+ ["let", ["hm", ["clone", "src-hm"]],
+ ["assocs!", "hm", "kvs"]]]],
+
+["def", "dissoc", ["fn", ["src-hm", "&", "ks"],
+ ["let", ["hm", ["clone", "src-hm"]],
+ ["do",
+ ["map", ["fn", ["k"], ["del", "hm", "k"]], "ks"],
+ "hm"]]]],
+
+["def", "_get", ["fn", ["obj", "key"],
+ ["if", ["nil?", "obj"],
+ null,
+ ["if", ["contains?", "obj", "key"],
+ ["get", "obj", "key"],
+ null]]]],
+
["def", "_count", ["fn", ["a"],
["if", ["=", null, "a"],
0,
@@ -46,6 +64,8 @@
["`", "false?"], "false?",
["`", "symbol"], "symbol",
["`", "symbol?"], "symbol?",
+ ["`", "keyword"], "keyword",
+ ["`", "keyword?"], "keyword?",
["`", "pr-str"], ["fn", ["&", "a"], ["pr-list", "a", true, ["`", " "]]],
["`", "str"], ["fn", ["&", "a"], ["pr-list", "a", false, ["`", ""]]],
@@ -72,9 +92,20 @@
["`", "/"], "div",
["`", "time-ms"], "time-ms",
- ["`", "list"], "list",
- ["`", "list?"], "list?",
-
+ ["`", "list"], "list",
+ ["`", "list?"], "list?",
+ ["`", "vector"], "vector",
+ ["`", "vector?"], "vector?",
+ ["`", "hash-map"], "hash-map",
+ ["`", "assoc"], "assoc",
+ ["`", "dissoc"], "dissoc",
+ ["`", "map?"], "map?",
+ ["`", "get"], "_get",
+ ["`", "contains?"], "contains?",
+ ["`", "keys"], "keys",
+ ["`", "vals"], "vals",
+
+ ["`", "sequential?"], "sequential?",
["`", "cons"], "cons",
["`", "concat"], "concat",
["`", "nth"], "_nth",