[plt-scheme] pretty-print?

From: John Clements (clements at brinckerhoff.org)
Date: Thu Apr 19 15:56:28 EDT 2007

On Apr 19, 2007, at 11:01 AM, dillogimp at gmail.com wrote:

> Welcome to MzScheme version 360, Copyright (c) 2004-2006 PLT Scheme
> Inc.
>
> (require (lib "pretty.ss"))
> (define sq (lambda (x) (* x x))) (sq 5)mzscheme
> (pretty-print sq)
> #<procedure:sq>
>
> This is not pretty...

Read the docs for pretty-print:

(pretty-print v [port])      PROCEDURE

Pretty-prints the value v using the same printed form as write, but  
with newlines and whitespace inserted to avoid lines longer than  
(pretty-print-columns), as controlled by (pretty-print-current-style- 
table). The printed form ends in a newline unless the pretty-print- 
columns parameter is set to 'infinity.

...


That is, the goal of pretty-print is to insert newlines and tabbing  
in a printed representation.  Not to conform to an aesthetic standard...

More generally, you may be curious to know whether it's possible to  
map a closure (that is to say, the result of evaluating a procedure  
declaration) to a string in a "more one-to-one" way.  I claim that  
there are multiple threads on this mailing list that discuss this  
topic.  Let me know if you have trouble locating them.

John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2223 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20070419/9252ab08/attachment.p7s>

Posted on the users mailing list.