pprint doesn't work with LispWorks

Discussion of Common Lisp
Post Reply
imba
Posts: 35
Joined: Sun Nov 21, 2010 2:13 pm

pprint doesn't work with LispWorks

Post by imba » Fri Nov 26, 2010 11:08 am

Hi,

Code: Select all

(pprint '(1 2 (4 5) 3))
doesn't produce

Code: Select all

(1 2
  (4 5)
3),

but (1 2 (4 5) 3)
With LispWorks Windows. What am I doing wrong?

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: pprint doesn't work with LispWorks

Post by Paul Donnelly » Sat Nov 27, 2010 6:29 pm

I think (1 2 (4 5) 3) is prettier than the other. If you want another behaviour, you could write your own printing routine.

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

Re: pprint doesn't work with LispWorks

Post by findinglisp » Mon Nov 29, 2010 9:25 pm

To follow-up on Paul's post, most pretty printers won't start to indent things until such time as the data gets close to a line length. If it all fits on a single line, per Paul's comment, it's pretty by definition. If you're looking for specific indentation behavior, you might have to write things yourself. Also, sometimes versions of pprint have options that might be able to control the output better.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

Post Reply