HCoop
/
jackhill
/
mal.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Current state of mal for Clojure West lighting talk.
[jackhill/mal.git]
/
clojure
/
src
/
step0_repl.clj
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
15
(defn PRINT [exp]
16
exp)
17
18
;; repl
19
(defn rep [strng] (PRINT (EVAL (READ strng), {})))
20
21
(defn -main [& args]
22
(loop []
23
(let [line (readline/readline "user> ")]
24
(when line
25
(println (rep line))
26
(recur)))))