When is the format actually printed in Common Lisp?
I have the following general Lisp code:
(defun micro-read-eval-print () (format t "Micro > ") (let ((form (read-line))))) When I run it, I get the following:
CL-USER> (micro-read-eval-print) (m-quote a) Micro > NIL Note that I typed "(m-quote a)" and the Lisp interpreter prints "Micro> NIL".
Now I expected these events to happen in reverse order. I would expect Micro to be printed first, as format approval will be indicated first. Why is it not printed first? And what do I need to do to make sure it is printed first?
Try to add
(defun micro-read-eval-print () (format t "Micro > ") (finish-output) (let ((form (read-line))))) I believe that you are faced with buffering the standard io (stdio), which in C usually bypasses through fflush() in this language.
finish-output seems to be the general Lisp equivalent of the C fflush standard library.