Merge pull request #377 from asarhaddon/fix-runtests-pre-eval
[jackhill/mal.git] / elisp / step0_repl.el
CommitLineData
ae28e856
VS
1(defun READ (input)
2 input)
3
4(defun EVAL (input)
5 input)
6
7(defun PRINT (input)
8 input)
9
10(defun readln (prompt)
11 ;; C-d throws an error
12 (ignore-errors (read-from-minibuffer prompt)))
13
14(defun println (format-string &rest args)
15 (if (not args)
16 (princ format-string)
17 (princ (apply 'format format-string args)))
18 (terpri))
19
20(defun main ()
21 (let (eof)
22 (while (not eof)
23 (let ((input (readln "user> ")))
24 (if input
25 (println input)
26 (setq eof t)
27 ;; print final newline
28 (terpri))))))
29
30(main)