[gambit-list] explicit pp

Stéphane Le Cornec coleste at videotron.ca
Fri Jul 24 10:55:31 EDT 2009


On 2009-7-24, at 1:35 , Marc Feeley wrote:
>
> On 24-Jul-09, at 12:56 AM, Stéphane Le Cornec wrote:
>
>> Is there a way to explicitly pretty-print? Something like:
>>
>>> (display '(a XXX b c))
>> (a
>>  b c)
>>>
>>
>> i.e. XXX outputs as some (newline) + spaces.
>
> How about
>
> > (display '(a "\n  " b c))
> (a
>   b c)
>
> I'm probably not understanding your question...  If you want to  
> pretty print, why not use the pretty-print procedure?  The display  
> procedure seems like the wrong choice for pretty printing...
>
> Marc
>

pp has its own logic as to where the whitespace goes. Unless there's a  
way to explicitly state where the (newline) should go...

Right now, there are a few place with code like this:
         (display "(manifest " output)
         (display name output)
         (newline output)
         (newline output)
         (display "  (version " output)
         (write version output)
         (display ")" output)
         (newline output)

It would be oh so much clearer to handle it this way:

         (write `(manifest ,name
                       (version ,version)
                       ...) output)

This would read back properly, but it is not pretty enough to be human- 
readable. So I'm trying to have that cake and eat it too, pretty code  
and pretty output.





More information about the Gambit-list mailing list