[plt-scheme] Format a string like code?

From: Ethan Herdrick (info at reatlas.com)
Date: Sun Feb 17 23:49:23 EST 2008

I want to take this list:

'(define (foo x) (* 2 (add1 x)  (expt x 2)))

And get a string like this:

(define (foo x)
    (* 2
       (add1 x)
       (expt x 2)))

How?  It looks like pretty-print only breaks lines that have reached a
certain length.  How about a function like what DrScheme uses to
indent code?

Thank you.  -Ethan

Posted on the users mailing list.