I'm going through the book ANSI Common Lisp by Paul Graham, and there's this example:
(defun ask-number ()
(format t "Please enter a number. ")
(let ((val (read)))
(if (numberp val)
val
(ask-number))))
It should behave like this:
$ (ask-number)
Please enter a number. a
Please enter a number. (ho hum)
Please enter a number. 52
52
But when I try it (SBCL 1.0.55), it doesn't print the format string until successful read:
$ (ask-number)
a
(ho hum)
52
Please enter a number. Please enter a number. Please enter a number.
52
Where's the error? How to make it behave the intended way?