1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 18:18:51 +03:00
mal/impls/janet/step0_repl.janet

32 lines
451 B
Plaintext

(defn READ
[code-str]
code-str)
(defn EVAL
[ast]
ast)
(defn PRINT
[ast]
ast)
(defn rep
[code-str]
(PRINT (EVAL (READ code-str))))
# getline gives problems
(defn getstdin [prompt buf]
(file/write stdout prompt)
(file/flush stdout)
(file/read stdin :line buf))
(defn main
[& args]
(var buf nil)
(while true
(set buf @"")
(getstdin "user> " buf)
(if (< 0 (length buf))
(prin (rep buf))
(break))))