Subject: [clisp-list] Pretty printing

From: Christophe Rhodes <[email-masked]>
Date: Thu Feb 13 08:28:12 2003

Hi,

I'm aware that the pretty printer implementation in CLISP, according
to the implementation notes isn't expected to be perfect...  I hope
this bug report (for clisp-2.30) helps to track some things down:

[3]> (format t "~&~@<; ~@;loading system definition from ~A into ~A.~@:>~%" 'foo 'bar)

*** - ; FUNCALL: the function ; NIL is undefined
; 1. Break ; [; 4]> 

So, two things look problematic here.  Firstly, I believe that the
format string is valid for the arguments, and so I don't expect the
crash, but rather that

; loading system definition from FOO into BAR.

be printed.

Secondly, the per-line prefix of "; " (indicated by the use of ~@; to
finish the first section of ~< ~@:>) seems to be interpreted as more
like a per-word prefix, as shown by the Break prompt.

Interestingly, FORMATTER doesn't seem to have quite the same problem:

[6]> (format t (formatter "~&~@<; ~@;loading system definition from ~A into ~A.~:@>~%") 'foo 'bar)  
; loading system definition from FOO into BAR.

though when given a longer string it doesn't seem to wrap correctly
(the "~:@>" asks for a conditional newline to be inserted at every
whitespace in the format string).

Cheers,

Christophe
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)