diff options
| author | Joel Martin <github@martintribe.org> | 2015-02-15 23:33:08 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-02-15 23:33:08 -0600 |
| commit | 2774a151313c2b6bef052f5f8906b912c7f60bf8 (patch) | |
| tree | 7d8fb508e89003d4a01f69a28f40bb8fa7121ae4 /miniMAL/core.json | |
| parent | f618f6a11c661a74e5805a75b51815a0cafebaaf (diff) | |
| download | mal-2774a151313c2b6bef052f5f8906b912c7f60bf8.tar.gz mal-2774a151313c2b6bef052f5f8906b912c7f60bf8.zip | |
miniMAL: step9
Diffstat (limited to 'miniMAL/core.json')
| -rw-r--r-- | miniMAL/core.json | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/miniMAL/core.json b/miniMAL/core.json index a5c44bd..52c2507 100644 --- a/miniMAL/core.json +++ b/miniMAL/core.json @@ -1,5 +1,11 @@ ["do", +["def", "_path", ["require", ["`", "path"]]], + +["def", "_node_readline", ["require", [".", "_path", ["`", "resolve"], + ["`", "."], + ["`", "node_readline.js"]]]], + ["def", "div", ["fn", ["a", "b"], ["parseInt", ["/", "a", "b"]]]], ["def", "_count", ["fn", ["a"], @@ -17,9 +23,26 @@ null, ["first", "seq"]]]], +["def", "_apply", ["fn", ["f", "&", "args"], + ["let", ["fn", ["if", ["malfunc?", "f"], ["get", "f", ["`", "fn"]], "f"], + "fargs", ["concat", ["slice", "args", 0, ["-", ["count", "args"], 1]], + ["nth", "args", ["-", ["count", "args"], 1]]]], + ["apply", "fn", "fargs"]]]], + +["def", "_map", ["fn", ["f", "seq"], + ["let", ["fn", ["if", ["malfunc?", "f"], ["get", "f", ["`", "fn"]], "f"]], + ["map", "fn", "seq"]]]], + ["def", "core-ns", ["hash-map", - ["`", "="], "equal?", + ["`", "="], "equal?", + ["`", "throw"], "throw", + + ["`", "nil?"], "nil?", + ["`", "true?"], "true?", + ["`", "false?"], "false?", + ["`", "symbol"], "symbol", + ["`", "symbol?"], "symbol?", ["`", "pr-str"], ["fn", ["&", "a"], ["pr-list", "a", true, ["`", " "]]], ["`", "str"], ["fn", ["&", "a"], ["pr-list", "a", false, ["`", ""]]], @@ -32,6 +55,8 @@ ["println", ["pr-list", "a", false, ["`", " "]]], null]], ["`", "read-string"], "read-str", + ["`", "readline"], ["fn", ["p"], + [".", "_node_readline", ["`", "readline"], "p"]], ["`", "slurp"], "slurp", ["`", "<"], "<", @@ -52,6 +77,8 @@ ["`", "first"], "_first", ["`", "rest"], ["fn", ["a"], ["rest", "a"]], ["`", "empty?"], "empty?", - ["`", "count"], "_count"]], + ["`", "count"], "_count", + ["`", "apply"], "_apply", + ["`", "map"], "_map"]], null] |
