Menu

#365 pprint-logical-block :suffix only printing inside lists

open
clisp (524)
5
2006-09-22
2006-09-22
No

When printing inside a list, the :suffix argument to
pprint-logical-block suppresses printing of other
items in the logical-block.

Below is a print-object method which prints structures
of type S which have a single slot A, using prefix and
suffix square brackets as: [S slot-a]

(defstruct s a)

(defmethod print-object ((o s) stream)
(pprint-logical-block (stream
nil :prefix "[" :suffix "]")
(princ "S " stream)
(princ (s-a o) stream)))

(make-s :a 1)
=> [S 1] ; correct

(list (make-s :a 1))
=> (]) ; incorrect, should be ([S 1])

Note: This bug is dependent only on the presence of a
non-NIL :suffix argument; the :prefix argument has no
effect.

[21]> (lisp-implementation-version)
"2.39 (2006-07-16) (built on stnt067 [192.168.0.1])"
[22]> (machine-type)
"PC/386"
[23]> (machine-version)
"PC/686"

Running on Windows XP SP2.

Discussion


Log in to post a comment.