Commit | Line | Data |
---|---|---|
c5d30235 JM |
1 | ["do", |
2 | ||
2774a151 JM |
3 | ["def", "_path", ["require", ["`", "path"]]], |
4 | ||
5 | ["def", "_node_readline", ["require", [".", "_path", ["`", "resolve"], | |
6 | ["`", "."], | |
7 | ["`", "node_readline.js"]]]], | |
8 | ||
c5d30235 JM |
9 | ["def", "div", ["fn", ["a", "b"], ["parseInt", ["/", "a", "b"]]]], |
10 | ||
d90c7844 JM |
11 | ["def", "time-ms", ["fn", [], |
12 | [".", ["new", "Date"], ["`", "getTime"]]]], | |
13 | ||
c5d30235 JM |
14 | ["def", "_count", ["fn", ["a"], |
15 | ["if", ["=", null, "a"], | |
16 | 0, | |
17 | ["count", "a"]]]], | |
18 | ||
f618f6a1 JM |
19 | ["def", "_nth", ["fn", ["seq", "idx"], |
20 | ["if", [">=", "idx", ["count", "seq"]], | |
21 | ["throw", "nth: index out of range"], | |
22 | ["nth", "seq", "idx"]]]], | |
23 | ||
24 | ["def", "_first", ["fn", ["seq"], | |
25 | ["if", ["empty?", "seq"], | |
26 | null, | |
27 | ["first", "seq"]]]], | |
28 | ||
2774a151 JM |
29 | ["def", "_apply", ["fn", ["f", "&", "args"], |
30 | ["let", ["fn", ["if", ["malfunc?", "f"], ["get", "f", ["`", "fn"]], "f"], | |
31 | "fargs", ["concat", ["slice", "args", 0, ["-", ["count", "args"], 1]], | |
32 | ["nth", "args", ["-", ["count", "args"], 1]]]], | |
33 | ["apply", "fn", "fargs"]]]], | |
34 | ||
35 | ["def", "_map", ["fn", ["f", "seq"], | |
36 | ["let", ["fn", ["if", ["malfunc?", "f"], ["get", "f", ["`", "fn"]], "f"]], | |
37 | ["map", "fn", "seq"]]]], | |
38 | ||
c5d30235 JM |
39 | ["def", "core-ns", |
40 | ["hash-map", | |
2774a151 JM |
41 | ["`", "="], "equal?", |
42 | ["`", "throw"], "throw", | |
43 | ||
44 | ["`", "nil?"], "nil?", | |
45 | ["`", "true?"], "true?", | |
46 | ["`", "false?"], "false?", | |
47 | ["`", "symbol"], "symbol", | |
48 | ["`", "symbol?"], "symbol?", | |
c5d30235 JM |
49 | |
50 | ["`", "pr-str"], ["fn", ["&", "a"], ["pr-list", "a", true, ["`", " "]]], | |
51 | ["`", "str"], ["fn", ["&", "a"], ["pr-list", "a", false, ["`", ""]]], | |
52 | ["`", "prn"], ["fn", ["&", "a"], | |
53 | ["do", | |
54 | ["println", ["pr-list", "a", true, ["`", " "]]], | |
55 | null]], | |
56 | ["`", "println"], ["fn", ["&", "a"], | |
57 | ["do", | |
58 | ["println", ["pr-list", "a", false, ["`", " "]]], | |
59 | null]], | |
9d8f0299 | 60 | ["`", "read-string"], "read-str", |
2774a151 JM |
61 | ["`", "readline"], ["fn", ["p"], |
62 | [".", "_node_readline", ["`", "readline"], "p"]], | |
9d8f0299 | 63 | ["`", "slurp"], "slurp", |
c5d30235 JM |
64 | |
65 | ["`", "<"], "<", | |
66 | ["`", "<="], "<=", | |
67 | ["`", ">"], ">", | |
68 | ["`", ">="], ">=", | |
69 | ["`", "+"], "+", | |
70 | ["`", "-"], "-", | |
71 | ["`", "*"], "*", | |
72 | ["`", "/"], "div", | |
d90c7844 | 73 | ["`", "time-ms"], "time-ms", |
c5d30235 JM |
74 | |
75 | ["`", "list"], "list", | |
76 | ["`", "list?"], "list?", | |
77 | ||
1981bf57 JM |
78 | ["`", "cons"], "cons", |
79 | ["`", "concat"], "concat", | |
f618f6a1 JM |
80 | ["`", "nth"], "_nth", |
81 | ["`", "first"], "_first", | |
82 | ["`", "rest"], ["fn", ["a"], ["rest", "a"]], | |
c5d30235 | 83 | ["`", "empty?"], "empty?", |
2774a151 JM |
84 | ["`", "count"], "_count", |
85 | ["`", "apply"], "_apply", | |
86 | ["`", "map"], "_map"]], | |
c5d30235 JM |
87 | |
88 | null] |