| 1 | ["do", |
| 2 | |
| 3 | ["def", "_path", ["require", ["`", "path"]]], |
| 4 | |
| 5 | ["def", "_node_readline", ["require", [".", "_path", ["`", "resolve"], |
| 6 | ["`", "."], |
| 7 | ["`", "node_readline.js"]]]], |
| 8 | |
| 9 | ["def", "div", ["fn", ["a", "b"], ["parseInt", ["/", "a", "b"]]]], |
| 10 | |
| 11 | ["def", "time-ms", ["fn", [], |
| 12 | [".", ["new", "Date"], ["`", "getTime"]]]], |
| 13 | |
| 14 | |
| 15 | ["def", "assoc", ["fn", ["src-hm", "&", "kvs"], |
| 16 | ["let", ["hm", ["clone", "src-hm"]], |
| 17 | ["assocs!", "hm", "kvs"]]]], |
| 18 | |
| 19 | ["def", "dissoc", ["fn", ["src-hm", "&", "ks"], |
| 20 | ["let", ["hm", ["clone", "src-hm"]], |
| 21 | ["do", |
| 22 | ["map", ["fn", ["k"], ["del", "hm", "k"]], "ks"], |
| 23 | "hm"]]]], |
| 24 | |
| 25 | ["def", "_get", ["fn", ["obj", "key"], |
| 26 | ["if", ["nil?", "obj"], |
| 27 | null, |
| 28 | ["if", ["contains?", "obj", "key"], |
| 29 | ["get", "obj", "key"], |
| 30 | null]]]], |
| 31 | |
| 32 | ["def", "_count", ["fn", ["a"], |
| 33 | ["if", ["=", null, "a"], |
| 34 | 0, |
| 35 | ["count", "a"]]]], |
| 36 | |
| 37 | ["def", "_nth", ["fn", ["seq", "idx"], |
| 38 | ["if", [">=", "idx", ["count", "seq"]], |
| 39 | ["throw", "nth: index out of range"], |
| 40 | ["nth", "seq", "idx"]]]], |
| 41 | |
| 42 | ["def", "_first", ["fn", ["seq"], |
| 43 | ["if", ["empty?", "seq"], |
| 44 | null, |
| 45 | ["first", "seq"]]]], |
| 46 | |
| 47 | ["def", "_apply", ["fn", ["f", "&", "args"], |
| 48 | ["let", ["fn", ["if", ["malfunc?", "f"], ["get", "f", ["`", "fn"]], "f"], |
| 49 | "fargs", ["concat", ["slice", "args", 0, ["-", ["count", "args"], 1]], |
| 50 | ["nth", "args", ["-", ["count", "args"], 1]]]], |
| 51 | ["apply", "fn", "fargs"]]]], |
| 52 | |
| 53 | ["def", "_map", ["fn", ["f", "seq"], |
| 54 | ["let", ["fn", ["if", ["malfunc?", "f"], ["get", "f", ["`", "fn"]], "f"]], |
| 55 | ["map", "fn", "seq"]]]], |
| 56 | |
| 57 | ["def", "with_meta", ["fn", ["obj", "m"], |
| 58 | ["let", ["new-obj", ["clone", "obj"]], |
| 59 | ["do", |
| 60 | ["set", "new-obj", ["`", "__meta__"], "m"], |
| 61 | "new-obj"]]]], |
| 62 | |
| 63 | ["def", "meta", ["fn", ["obj"], |
| 64 | ["if", ["or", ["sequential?", "obj"], |
| 65 | ["map?", "obj"], |
| 66 | ["malfunc?", "obj"]], |
| 67 | ["if", ["contains?", "obj", ["`", "__meta__"]], |
| 68 | ["get", "obj", ["`", "__meta__"]], |
| 69 | null], |
| 70 | null]]], |
| 71 | |
| 72 | ["def", "reset!", ["fn", ["atm", "val"], |
| 73 | ["set", "atm", ["`", "val"], "val"]]], |
| 74 | |
| 75 | ["def", "swap!", ["fn", ["atm", "f", "&", "args"], |
| 76 | ["let", ["fn", ["if", ["malfunc?", "f"], ["get", "f", ["`", "fn"]], "f"], |
| 77 | "fargs", ["cons", ["get", "atm", ["`", "val"]], "args"], |
| 78 | "val", ["apply", "fn", "fargs"]], |
| 79 | ["do", |
| 80 | ["set", "atm", ["`", "val"], "val"], |
| 81 | "val"]]]], |
| 82 | |
| 83 | ["def", "core-ns", |
| 84 | ["hash-map", |
| 85 | ["`", "="], "equal?", |
| 86 | ["`", "throw"], "throw", |
| 87 | |
| 88 | ["`", "nil?"], "nil?", |
| 89 | ["`", "true?"], "true?", |
| 90 | ["`", "false?"], "false?", |
| 91 | ["`", "symbol"], "symbol", |
| 92 | ["`", "symbol?"], "symbol?", |
| 93 | ["`", "keyword"], "keyword", |
| 94 | ["`", "keyword?"], "keyword?", |
| 95 | |
| 96 | ["`", "pr-str"], ["fn", ["&", "a"], ["pr-list", "a", true, ["`", " "]]], |
| 97 | ["`", "str"], ["fn", ["&", "a"], ["pr-list", "a", false, ["`", ""]]], |
| 98 | ["`", "prn"], ["fn", ["&", "a"], |
| 99 | ["do", |
| 100 | ["println", ["pr-list", "a", true, ["`", " "]]], |
| 101 | null]], |
| 102 | ["`", "println"], ["fn", ["&", "a"], |
| 103 | ["do", |
| 104 | ["println", ["pr-list", "a", false, ["`", " "]]], |
| 105 | null]], |
| 106 | ["`", "read-string"], "read-str", |
| 107 | ["`", "readline"], ["fn", ["p"], |
| 108 | [".", "_node_readline", ["`", "readline"], "p"]], |
| 109 | ["`", "slurp"], "slurp", |
| 110 | |
| 111 | ["`", "<"], "<", |
| 112 | ["`", "<="], "<=", |
| 113 | ["`", ">"], ">", |
| 114 | ["`", ">="], ">=", |
| 115 | ["`", "+"], "+", |
| 116 | ["`", "-"], "-", |
| 117 | ["`", "*"], "*", |
| 118 | ["`", "/"], "div", |
| 119 | ["`", "time-ms"], "time-ms", |
| 120 | |
| 121 | ["`", "list"], "list", |
| 122 | ["`", "list?"], "list?", |
| 123 | ["`", "vector"], "vector", |
| 124 | ["`", "vector?"], "vector?", |
| 125 | ["`", "hash-map"], "hash-map", |
| 126 | ["`", "assoc"], "assoc", |
| 127 | ["`", "dissoc"], "dissoc", |
| 128 | ["`", "map?"], "map?", |
| 129 | ["`", "get"], "_get", |
| 130 | ["`", "contains?"], "contains?", |
| 131 | ["`", "keys"], "keys", |
| 132 | ["`", "vals"], "vals", |
| 133 | |
| 134 | ["`", "sequential?"], "sequential?", |
| 135 | ["`", "cons"], "cons", |
| 136 | ["`", "concat"], "concat", |
| 137 | ["`", "nth"], "_nth", |
| 138 | ["`", "first"], "_first", |
| 139 | ["`", "rest"], ["fn", ["a"], ["rest", "a"]], |
| 140 | ["`", "empty?"], "empty?", |
| 141 | ["`", "count"], "_count", |
| 142 | ["`", "apply"], "_apply", |
| 143 | ["`", "map"], "_map", |
| 144 | ["`", "conj"], null, |
| 145 | |
| 146 | ["`", "with-meta"], "with_meta", |
| 147 | ["`", "meta"], "meta", |
| 148 | ["`", "atom"], "atom", |
| 149 | ["`", "atom?"], "atom?", |
| 150 | ["`", "deref"], ["fn", ["a"], ["get", "a", ["`", "val"]]], |
| 151 | ["`", "reset!"], "reset!", |
| 152 | ["`", "swap!"], "swap!"]], |
| 153 | |
| 154 | null] |