Travis: comment out self-host tests in master.
[jackhill/mal.git] / miniMAL / printer.json
CommitLineData
c1fe72ae
JM
1["do",
2
3["def", "pr-str", ["fn", ["exp", "print_readably"],
4 ["if", ["list?", "exp"],
5 ["str",
6 ["`", "("],
7 [".", ["map", ["fn", ["x"], ["pr-str", "x", "print_readably"]], "exp"],
8 ["`", "join"], ["`", " "]],
9 ["`", ")"]],
32045546
JM
10 ["if", ["vector?", "exp"],
11 ["str",
12 ["`", "["],
13 [".", ["map", ["fn", ["x"], ["pr-str", "x", "print_readably"]], "exp"],
14 ["`", "join"], ["`", " "]],
15 ["`", "]"]],
16 ["if", ["map?", "exp"],
17 ["str",
18 ["`", "{"],
19 [".", ["map", ["fn", ["k"],
20 ["str", ["pr-str", "k", "print_readably"],
21 ["`", " "],
22 ["pr-str", ["get", "exp", "k"], "print_readably"]]],
23 ["keys", "exp"]],
24 ["`", "join"], ["`", " "]],
25 ["`", "}"]],
3fb3743f 26 ["if", ["=", ["`", "[object String]"], ["classOf", "exp"]],
32045546
JM
27 ["if", ["=", ["`", "\u029e"], ["get", "exp", 0]],
28 ["str", ["`", ":"], ["slice", "exp", 1]],
29 ["if", "print_readably",
30 ["str", ["`", "\""],
c5d30235 31 [".",
32045546
JM
32 [".",
33 [".", "exp",
34 ["`", "replace"], ["RegExp", ["`", "\\\\"], ["`", "g"]], ["`", "\\\\"]],
35 ["`", "replace"], ["RegExp", ["`", "\""], ["`", "g"]], ["`", "\\\""]],
36 ["`", "replace"], ["RegExp", ["`", "\n"], ["`", "g"]], ["`", "\\n"]],
37 ["`", "\""]],
38 "exp"]],
3fb3743f 39 ["if", ["=", ["`", "[object Number]"], ["classOf", "exp"]],
c5d30235 40 "exp",
c1fe72ae
JM
41 ["if", ["=", null, "exp"],
42 ["`", "nil"],
43 ["if", ["=", true, "exp"],
44 ["`", "true"],
45 ["if", ["=", false, "exp"],
46 ["`", "false"],
5351b94a 47 ["if", ["symbol?", "exp"],
c1fe72ae 48 ["get", "exp", ["`", "val"]],
dc2c5b3d
JM
49 ["if", ["malfunc?", "exp"],
50 ["str", ["`", "(fn* "],
51 ["pr-str", ["get", "exp", ["`", "params"]]],
52 ["`", " "],
53 ["pr-str", ["get", "exp", ["`", "ast"]]],
54 ["`", ")"]],
3fb3743f
JM
55 ["if", ["=", ["`", "[object Function]"], ["classOf", "exp"]],
56 ["str", ["`", "#<native function>"]],
8cfab776
JM
57 ["if", ["atom?", "exp"],
58 ["str", ["`", "(atom "], ["get", "exp", ["`", "val"]], ["`", ")"]],
3fb3743f 59 ["str", ["`", "#<unknown: "], "exp", ["`", ">"]]]]]]]]]]]]]]]],
c1fe72ae 60
c5d30235
JM
61["def", "pr-list", ["fn", ["lst", "print_readably", "sep"],
62 [".", ["map", ["fn", ["s"], ["pr-str", "s", "print_readably"]], "lst"],
63 ["`", "join"], "sep"]]],
64
c1fe72ae
JM
65null
66]