7 (defun mal-read (string)
10 (defun mal-eval (ast env
)
13 (defun mal-print (expression)
17 (mal-print (mal-eval (mal-read string
)
18 (make-hash-table :test
#'equal
))))
21 ;;; The test runner sets this environment variable, in which case we do
22 ;;; use readline since tests do not work with the readline interface
23 (defvar use-readline-p
(not (string= (ext:getenv
"PERL_RL") "false")))
25 (defvar *history-file
* (namestring (merge-pathnames (user-homedir-pathname)
26 ".mal-clisp-history")))
28 (defun load-history ()
29 (readline:read-history
*history-file
*))
31 (defun save-history ()
32 (readline:write-history
*history-file
*))
38 (defun raw-input (prompt)
39 (format *standard-output
* prompt
)
40 (force-output *standard-output
*)
41 (read-line *standard-input
* nil
))
43 (defun mal-readline (prompt)
44 (let ((input (if use-readline-p
45 (readline:readline prompt
)
47 (when (and use-readline-p
49 (not (zerop (length input
))))
50 (readline:add-history input
))
53 (defun mal-writeline (string)
58 (loop do
(let ((line (mal-readline "user> ")))
60 (mal-writeline (rep line
))
65 ;; Do not start REPL inside Emacs
66 (unless (member :swank
*features
*)