READ(str): return reader.read_str(str)
-pair?(ast): return ... // true if non-empty sequence
quasiquote(ast): return ... // quasiquote
macro?(ast, env): return ... // true if macro call
;; core.mal: defined using the language itself
rep("(def! *host-language* \"racket\")")
rep("(def! not (fn* (a) (if a false true)))")
-rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))")
+rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \"\nnil)\")))))")
rep("(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))");
if cmdline_args: rep("(load-file \"" + args[0] + "\")"); exit 0
'sequential? sequential?,
'cons: (a) -> concat([a[0]], a[1]),
'concat: (a) -> reduce(concat, [], a),
+ 'vec: (l) -> l converted to vector,
'nth: (a) -> a[0][a[1]] OR raise "nth: index out of range",
'first: (a) -> a[0][0] OR nil,
'rest: (a) -> a[0][1..] OR list(),