Subject: Re: Code beautifiers, anyone?
To: Garrett D'Amore <garrett_damore@tadpole.com>
From: Urban Boquist <urban@boquist.net>
List: current-users
Date: 08/25/2006 09:48:46
>>>>> Garrett D'Amore writes:

Garrett> Thor Lancelot Simon wrote:
>> What he said -- you won't do better than indent(1) with a "simple"
>> tool.  But if you want an elegant way to do this, I'd urge you to
>> do it in LISP; every tool has its own best use, and this is the
>> kind of thing LISP is very, very good at.

Garrett> Out of a sense of curious, (and I know I'm going to regret
Garrett> asking later), what is it about Lisp that makes it so great
Garrett> this kind of thing?

Try reading "The Design of a Pretty-printing Library" by John Hughes [1].

The paper uses Haskell rather than Lisp but it should be fairly easy
to do it in Lisp too. And the whole approach is so elegant that you
will become for ever in love with functional programming. I promise you! ;-)

Best regards,

        -- Urban

[1] http://citeseer.ist.psu.edu/rd/38375528%2C9202%2C1%2C0.25%2CDownload/http://citeseer.ist.psu.edu/cache/papers/cs/471/http:zSzzSzwww.cs.chalmers.sezSz%7ErjmhzSzPaperszSzpretty.pdf/hughes95design.pdf