Thanks for the explanation; indeed finish-output takes care of the
problem. The CL implementation I'm porting the code from apparently
did its own finish-output after each princ.
>>>>> "Christophe" == Christophe Rhodes <csr21@...> writes:
Christophe> Liam Healy <lnp@...> writes:
>> Strings get garbled up in princ:
>> Looks like maybe the last (or only) line doesn't get flushed until
>> the next princ, or until you quit sbcl?
Christophe> Right. The reason you see garbling is that you're effectively
Christophe> printing to two different streams here: T as a stream designator means
Christophe> *terminal-io*, which is buffered; the repl prints return values to
Christophe> *standard-output*, which is also buffered; to you they look the same,
Christophe> though, because they're both going to your terminal.
Christophe> If you need to ensure that all output is flushed at any point on a
Christophe> given stream, use the Common Lisp functions FORCE-OUTPUT or
Christophe> http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
Christophe> (set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
Christophe> (defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)