diff options
Diffstat (limited to 'clojure/src/step1_read_print.clj')
| -rw-r--r-- | clojure/src/step1_read_print.clj | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/clojure/src/step1_read_print.clj b/clojure/src/step1_read_print.clj index f15131a..21b297d 100644 --- a/clojure/src/step1_read_print.clj +++ b/clojure/src/step1_read_print.clj @@ -21,13 +21,16 @@ [strng] (PRINT (EVAL (READ strng) {}))) +;; repl loop +(defn repl-loop [] + (let [line (readline/readline "user> ")] + (when line + (when-not (re-seq #"^\s*$|^\s*;.*$" line) ; blank/comment + (try + (println (rep line)) + (catch Throwable e + (clojure.repl/pst e)))) + (recur)))) + (defn -main [& args] - (loop [] - (let [line (readline/readline "user> ")] - (when line - (when-not (re-seq #"^\s*$|^\s*;.*$" line) ; blank/comment - (try - (println (rep line)) - (catch Throwable e - (clojure.repl/pst e)))) - (recur))))) + (repl-loop)) |
