8 (defun mal-read (string)
14 (defun mal-print (expression)
18 (mal-print (mal-eval (mal-read string
))))
20 (defvar *use-readline-p
* nil
)
22 (defun raw-input (prompt)
23 (format *standard-output
* prompt
)
24 (force-output *standard-output
*)
25 (read-line *standard-input
* nil
))
27 (defun mal-readline (prompt)
29 (cl-readline:readline
:prompt prompt
31 :novelty-check
(lambda (old new
)
32 (not (string= old new
))))
35 (defun mal-writeline (string)
38 (force-output *standard-output
*)))
40 (defun main (&optional
(argv nil argv-provided-p
))
41 (declare (ignorable argv argv-provided-p
))
42 (setf *use-readline-p
* (not (or (string= (uiop:getenv
"PERL_RL") "false")
43 (string= (uiop:getenv
"TERM") "dumb"))))
44 (loop do
(let ((line (mal-readline "user> ")))
45 (if line
(mal-writeline (rep line
)) (return)))))