Lisp HUG Maillist Archive

buggy pprint?


Either it's too late on a friday, or pprint is buggy in both LW 4 & 5,
on linux, mac or windows. 

As far as I can tell from the standard (*), pprint should not interfer
with *print-readably*, but rather be equivalent to (write ... :escape
t :pretty t), or, equivalently, (let ((*print-pretty* t))(print ...))

CL-USER 1 > (let ((*print-readably* t))(pprint '(((((((((((((()))))))))))))))(values))

((((((((((#))))))))))

Although it should be equivalent to:

CL-USER 2 > (let ((*print-readably* t)(*print-pretty* t))(print '(((((((((((((()))))))))))))))(values))

(((((((((((((NIL))))))))))))) 

or to:

CL-USER 3 > (let ((*print-readably* t))(write '(((((((((((((()))))))))))))) :escape t :pretty t)(values))
(((((((((((((NIL)))))))))))))

As far as I can tell, 5.0 is actually less broken than 4.4.6 (only
Windows version tested), which does not observe *print-readably* in
case (2) either, i.e. in LWW 4.4.6 print is buggy as well.

(*) The standard explicitly says that "The functions prin1 and print
do not bind *print-readably*". I think it should have mentioned pprint
in that sentence as well, because from the examples that follow, which
translate prin*-calls to calls to write, pprint is clearly equivalent
to prin1 except for passing :pretty t to write.

-- 
  (espen)


Re: buggy pprint?

Unable to parse email body. Email id is 5836

Re: buggy pprint?

Martin Simmons <martin@lispworks.com> writes:

> I think the problem might be the interaction of *print-level* and
> *print-readably* (see "Specifically, if *print-readably* is true..." in
> http://www.lispworks.com/documentation/HyperSpec/Body/v_pr_rda.htm).

Yes, that's what I thought too.

> It looks like a bug that pprint doesn't deal with that interaction.

I assume you will look into it, then? (I have replaced pprint usage
with *print-pretty*-usage, so I'm in no hurry to get a fix myself)
-- 
  (espen)


Updated at: 2020-12-10 08:47 UTC