2015-02-16 01:34:55 +03:00
|
|
|
["do",
|
|
|
|
|
2015-02-16 08:33:08 +03:00
|
|
|
["def", "_path", ["require", ["`", "path"]]],
|
|
|
|
|
|
|
|
["def", "_node_readline", ["require", [".", "_path", ["`", "resolve"],
|
|
|
|
["`", "."],
|
|
|
|
["`", "node_readline.js"]]]],
|
|
|
|
|
2016-02-11 18:19:53 +03:00
|
|
|
["def", "_string?", ["fn", ["s"],
|
|
|
|
["and", ["string?", "s"],
|
|
|
|
["not", ["=", ["`", "\u029e"], ["get", "s", 0]]]]]],
|
|
|
|
|
2024-08-03 01:47:24 +03:00
|
|
|
["def", "_function?", ["fn", ["a"],
|
|
|
|
["isa", "a", "Function"]]],
|
|
|
|
|
|
|
|
["def", "_number?", ["fn", ["a"],
|
|
|
|
["=", ["`", "[object Number]"], ["classOf", "a"]]]],
|
|
|
|
|
2015-02-16 01:34:55 +03:00
|
|
|
["def", "div", ["fn", ["a", "b"], ["parseInt", ["/", "a", "b"]]]],
|
|
|
|
|
2015-02-16 09:01:10 +03:00
|
|
|
["def", "time-ms", ["fn", [],
|
|
|
|
[".", ["new", "Date"], ["`", "getTime"]]]],
|
|
|
|
|
2015-02-16 09:33:30 +03:00
|
|
|
|
|
|
|
["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"],
|
2017-02-11 07:19:55 +03:00
|
|
|
["if", ["null?", "obj"],
|
2015-02-16 09:33:30 +03:00
|
|
|
null,
|
|
|
|
["if", ["contains?", "obj", "key"],
|
|
|
|
["get", "obj", "key"],
|
|
|
|
null]]]],
|
|
|
|
|
2015-02-16 01:34:55 +03:00
|
|
|
["def", "_count", ["fn", ["a"],
|
|
|
|
["if", ["=", null, "a"],
|
|
|
|
0,
|
|
|
|
["count", "a"]]]],
|
|
|
|
|
2015-02-16 07:04:45 +03:00
|
|
|
["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"]]]],
|
|
|
|
|
2016-01-30 07:24:49 +03:00
|
|
|
["def", "_rest", ["fn", ["seq"],
|
|
|
|
["if", ["empty?", "seq"],
|
|
|
|
["`", []],
|
|
|
|
["rest", "seq"]]]],
|
|
|
|
|
2015-02-16 08:33:08 +03:00
|
|
|
["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"]]]],
|
|
|
|
|
2016-02-11 18:19:53 +03:00
|
|
|
["def", "_conj", ["fn", ["seq", "&", "a"],
|
|
|
|
["if", ["list?", "seq"],
|
|
|
|
[".", [".", "a", ["`", "reverse"]], ["`", "concat"], "seq"],
|
|
|
|
["vectorl", [".", "seq", ["`", "concat"], "a"]]]]],
|
|
|
|
|
|
|
|
["def", "_seq", ["fn", ["obj"],
|
|
|
|
["if", ["list?", "obj"],
|
|
|
|
["if", [">", ["count", "obj"], 0], "obj", null],
|
|
|
|
["if", ["vector?", "obj"],
|
|
|
|
["if", [">", ["count", "obj"], 0], ["slice", "obj", 0], null],
|
|
|
|
["if", ["string?", "obj"],
|
|
|
|
["if", [">", ["count", "obj"], 0],
|
|
|
|
[".", "obj", ["`", "split"], ["`", ""]],
|
|
|
|
null],
|
2017-02-11 07:19:55 +03:00
|
|
|
["if", ["null?", "obj"],
|
2016-02-11 18:19:53 +03:00
|
|
|
null,
|
|
|
|
["throw", "seq: called on non-sequence"]
|
|
|
|
]]]]]],
|
|
|
|
|
2015-02-16 10:15:35 +03:00
|
|
|
["def", "with_meta", ["fn", ["obj", "m"],
|
|
|
|
["let", ["new-obj", ["clone", "obj"]],
|
|
|
|
["do",
|
|
|
|
["set", "new-obj", ["`", "__meta__"], "m"],
|
|
|
|
"new-obj"]]]],
|
|
|
|
|
|
|
|
["def", "meta", ["fn", ["obj"],
|
|
|
|
["if", ["or", ["sequential?", "obj"],
|
|
|
|
["map?", "obj"],
|
|
|
|
["malfunc?", "obj"]],
|
|
|
|
["if", ["contains?", "obj", ["`", "__meta__"]],
|
|
|
|
["get", "obj", ["`", "__meta__"]],
|
|
|
|
null],
|
|
|
|
null]]],
|
|
|
|
|
2015-02-16 10:50:04 +03:00
|
|
|
["def", "reset!", ["fn", ["atm", "val"],
|
2017-02-11 07:19:55 +03:00
|
|
|
["do", ["set", "atm", ["`", "val"], "val"], "val"]]],
|
2015-02-16 10:50:04 +03:00
|
|
|
|
|
|
|
["def", "swap!", ["fn", ["atm", "f", "&", "args"],
|
|
|
|
["let", ["fn", ["if", ["malfunc?", "f"], ["get", "f", ["`", "fn"]], "f"],
|
|
|
|
"fargs", ["cons", ["get", "atm", ["`", "val"]], "args"],
|
|
|
|
"val", ["apply", "fn", "fargs"]],
|
|
|
|
["do",
|
|
|
|
["set", "atm", ["`", "val"], "val"],
|
|
|
|
"val"]]]],
|
2015-02-16 10:15:35 +03:00
|
|
|
|
2015-02-16 01:34:55 +03:00
|
|
|
["def", "core-ns",
|
|
|
|
["hash-map",
|
2015-02-16 08:33:08 +03:00
|
|
|
["`", "="], "equal?",
|
|
|
|
["`", "throw"], "throw",
|
|
|
|
|
2017-02-11 07:19:55 +03:00
|
|
|
["`", "nil?"], "null?",
|
2015-02-16 08:33:08 +03:00
|
|
|
["`", "true?"], "true?",
|
|
|
|
["`", "false?"], "false?",
|
2016-02-11 18:19:53 +03:00
|
|
|
["`", "string?"], "_string?",
|
2015-02-16 08:33:08 +03:00
|
|
|
["`", "symbol"], "symbol",
|
|
|
|
["`", "symbol?"], "symbol?",
|
2015-02-16 09:33:30 +03:00
|
|
|
["`", "keyword"], "keyword",
|
|
|
|
["`", "keyword?"], "keyword?",
|
2024-08-03 01:47:24 +03:00
|
|
|
["`", "number?"], "_number?",
|
2017-10-24 17:31:16 +03:00
|
|
|
["`", "fn?"], ["fn", ["a"],
|
2024-08-03 01:47:24 +03:00
|
|
|
["or", ["_function?", "a"],
|
2017-10-24 17:31:16 +03:00
|
|
|
["and", ["malfunc?", "a"],
|
|
|
|
["not", ["get", "a", ["`", "macro?"]]]]]],
|
|
|
|
["`", "macro?"], ["fn", ["a"],
|
|
|
|
["and", ["malfunc?", "a"],
|
|
|
|
["get", "a", ["`", "macro?"]]]],
|
2015-02-16 01:34:55 +03:00
|
|
|
|
|
|
|
["`", "pr-str"], ["fn", ["&", "a"], ["pr-list", "a", true, ["`", " "]]],
|
|
|
|
["`", "str"], ["fn", ["&", "a"], ["pr-list", "a", false, ["`", ""]]],
|
|
|
|
["`", "prn"], ["fn", ["&", "a"],
|
|
|
|
["do",
|
|
|
|
["println", ["pr-list", "a", true, ["`", " "]]],
|
|
|
|
null]],
|
|
|
|
["`", "println"], ["fn", ["&", "a"],
|
|
|
|
["do",
|
|
|
|
["println", ["pr-list", "a", false, ["`", " "]]],
|
|
|
|
null]],
|
2015-02-16 05:11:11 +03:00
|
|
|
["`", "read-string"], "read-str",
|
2015-02-16 08:33:08 +03:00
|
|
|
["`", "readline"], ["fn", ["p"],
|
|
|
|
[".", "_node_readline", ["`", "readline"], "p"]],
|
2015-02-16 05:11:11 +03:00
|
|
|
["`", "slurp"], "slurp",
|
2015-02-16 01:34:55 +03:00
|
|
|
|
|
|
|
["`", "<"], "<",
|
|
|
|
["`", "<="], "<=",
|
|
|
|
["`", ">"], ">",
|
|
|
|
["`", ">="], ">=",
|
|
|
|
["`", "+"], "+",
|
|
|
|
["`", "-"], "-",
|
|
|
|
["`", "*"], "*",
|
|
|
|
["`", "/"], "div",
|
2015-02-16 09:01:10 +03:00
|
|
|
["`", "time-ms"], "time-ms",
|
2015-02-16 01:34:55 +03:00
|
|
|
|
2015-02-16 09:33:30 +03:00
|
|
|
["`", "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?",
|
2015-02-16 05:46:19 +03:00
|
|
|
["`", "cons"], "cons",
|
|
|
|
["`", "concat"], "concat",
|
2020-07-21 19:01:48 +03:00
|
|
|
["`", "vec"], "vectorl",
|
2015-02-16 07:04:45 +03:00
|
|
|
["`", "nth"], "_nth",
|
|
|
|
["`", "first"], "_first",
|
2016-01-30 07:24:49 +03:00
|
|
|
["`", "rest"], "_rest",
|
2015-02-16 01:34:55 +03:00
|
|
|
["`", "empty?"], "empty?",
|
2015-02-16 10:50:04 +03:00
|
|
|
["`", "count"], "_count",
|
|
|
|
["`", "apply"], "_apply",
|
|
|
|
["`", "map"], "_map",
|
2016-02-11 18:19:53 +03:00
|
|
|
|
|
|
|
["`", "conj"], "_conj",
|
|
|
|
["`", "seq"], "_seq",
|
2015-02-16 10:15:35 +03:00
|
|
|
|
|
|
|
["`", "with-meta"], "with_meta",
|
2015-02-16 10:50:04 +03:00
|
|
|
["`", "meta"], "meta",
|
|
|
|
["`", "atom"], "atom",
|
|
|
|
["`", "atom?"], "atom?",
|
|
|
|
["`", "deref"], ["fn", ["a"], ["get", "a", ["`", "val"]]],
|
|
|
|
["`", "reset!"], "reset!",
|
|
|
|
["`", "swap!"], "swap!"]],
|
2015-02-16 01:34:55 +03:00
|
|
|
|
|
|
|
null]
|