On Tue, 2004-09-07 at 23:50, Jay Belanger wrote:
> to_lisp() will bring about the lisp underlying lisp, but I was
> wondering what it's supposed to look like. With an underlying cmucl,
> to_lisp() used to use the cmucl prompt, but now it uses the prompt
> MAXIMA>
> Is that right?
Yes. to_lisp() used to send the user in to the read-eval-print loop of
the underlying lisp. That created a problem for programs interfacing to
maxima; they had to guess the behavior of every possible underlying
lisp. When I added the *prompt-prefix* and *prompt-suffix* variables the
only way to make them work with to_lisp was to create our own
read-eval-print loop. It looked like this:
(defun maxima-read-eval-print-loop ()
(setf *debugger-hook* #'maxima-lisp-debugger-repl)
(loop
(catch 'to-maxima-repl
(format t "~a~%~a> ~a" *prompt-prefix*
(package-name *package*) *prompt-suffix*)
(let ((form (read)))
(prin1 (eval form))))))
> Also, I have gcl, sbcl, cmucl and clisp installed, and in each case
> to_lisp() will bring about lisp with the input prompt MAXIMA>, except
> for sbcl, which won't have an input prompt but will have MAXIMA> as an
> output prompt. Why is the behavior different for sbcl?
I am glad you caught this. I just updated the above function with a
(finish-output):
(defun maxima-read-eval-print-loop ()
(setf *debugger-hook* #'maxima-lisp-debugger-repl)
(loop
(catch 'to-maxima-repl
(format t "~a~%~a> ~a" *prompt-prefix*
(package-name *package*) *prompt-suffix*)
(finish-output)
(let ((form (read)))
(prin1 (eval form))))))
You should now always get the prompt before you are asked for input.
Thanks,
Jim