1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00
mal/elisp/step0_repl.el
Vasilij Schneidermann ae28e856fb Implement step 0
2016-02-28 21:21:38 +01:00

31 lines
559 B
EmacsLisp

(defun READ (input)
input)
(defun EVAL (input)
input)
(defun PRINT (input)
input)
(defun readln (prompt)
;; C-d throws an error
(ignore-errors (read-from-minibuffer prompt)))
(defun println (format-string &rest args)
(if (not args)
(princ format-string)
(princ (apply 'format format-string args)))
(terpri))
(defun main ()
(let (eof)
(while (not eof)
(let ((input (readln "user> ")))
(if input
(println input)
(setq eof t)
;; print final newline
(terpri))))))
(main)