All: *ARGV* and *host-language*. Misc syncing/fixes.
[jackhill/mal.git] / clojure / src / step0_repl.clj
CommitLineData
31690700
JM
1(ns step0-repl
2 (:require [readline]))
3
4
5;; read
6(defn READ [& [strng]]
7 (let [line (if strng strng (read-line))]
8 strng))
9
10;; eval
11(defn EVAL [ast env]
12 (eval (read-string ast)))
13
14;; print
a34b0200 15(defn PRINT [exp] exp)
31690700
JM
16
17;; repl
18(defn rep [strng] (PRINT (EVAL (READ strng), {})))
86b689f3
JM
19;; repl loop
20(defn repl-loop []
21 (let [line (readline/readline "user> ")]
22 (when line
23 (println (rep line))
24 (recur))))
31690700 25
a34b0200 26(defn -main [& args]
86b689f3 27 (repl-loop))