[armedbear-devel] Using print and read together.

Zach Beane xach at xach.com
Mon Jun 13 13:50:16 UTC 2011


Ted Kosan <ted.kosan at gmail.com> writes:

> Hello,
>
> I am currently working through the "Land of Lisp" book by Conrad
> Barski and I am using ABCL to run all of the code in the book. In the
> following code, the prompt that is printed by 'print' is not seen
> until after 'read' returns:
>
> (defun add-five()
>     (print "Pleaser enter a number:")
>     (let ((num (read)))
>         (print "When I add five I get")
>         (print (+ num 5))))
>
> Is it possible to configure ABCL to have the output from 'print' be
> visible immediately so that it can be used to prompt the user to input
> some information?

The portable way to do it is to call (force-output) or (finish-output)
after printing the prompt.

Zach




More information about the armedbear-devel mailing list