Re: PPRINT-LOGICAL-BLOCK question (was lisp-hug@xanalys.com)
I have a PrettyPrinter implementation in Java. It implements all of CL
API sans the macros.
If anybody is interested I will resurrect it.
It is a porting of CMUCL version
Cheers
Marco
On Wednesday, Aug 27, 2003, at 05:08 America/New_York, Jason Trenouth
wrote:
>>>>>> On Sat, 16 Aug 2003 21:02:34 +0100, "Simon Katz"
>>>>>> <simon@nomistech.com> said:
>
> Jason> From: "Jason Trenouth" <jason.trenouth@GlobalGraphics.com>
> Jason>
> Jason> Try using ~_ (pprint-newline) with and without modifiers
> instead of
> Jason> ~&. It probably interacts better with pprint-logical-block.
>
> Simon> Thanks for the suggestion. I've had a look at the Hyperspec
> and a
> Simon> play, but I don't think ~_ does what I want.
>
> Simon> I'd been hoping to simply add uses of a WITH-INDENTATION
> macro
> Simon> to existing code so that I could indent blocks of printed
> output
> Simon> nicely:
>
>
> Simon> (defmacro with-indentation ((stream n &optional (c #\space))
> Simon> &body body)
> Simon> `(pprint-logical-block
> Simon> (,stream
> Simon> nil
> Simon> :per-line-prefix (make-string ,n :initial-element
> ,c))
> Simon> ,@body))
>
>
> Simon> Perhaps there's another way to write a WITH-INDENTATION
> macro?
> Simon> Hmmmm.
> Simon> Perhaps I could define my own stream class that:
> Simon> - knows about the current indentation level
> Simon> - passes output on to a "real" stream
> Simon> - makes modifications according to the current indentation
> level.
>
> As it happens that's exactly what I did myself in Java on a project.
>
> Prettyprinting is a different (more advanced) concept. It is concerned
> with filling a page with structured output and working out when best
> to put in line breaks. Indenting is then necessary to visually
> associate the parts of the structure after such line breaks.
>
> That said, I have recently used pprint-logical-block to do some
> indenting. I had more success in LW with PPRINT-INDENT than
> :PER-LINE-PREFIX. Unfortunately, the same code in CLISP produced very
> different (and inferior) output.
>
> Simon> When I find time I'll take a look at the documentation for
> defining
> Simon> ones own streams.
>
> Simon> For the moment I've simply changed my code to get most of
> what I want
> Simon> in a different (and more hacky) way.
>
> __Jason
>
--
Marco Antoniotti
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
715 Broadway 10th FL fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________