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