One note about this: it’s not really a question about indentation, which isn’t 
ludicrously hard, it’s a question about inserting linebreaks, which IMHO is 
much harder. Specifically, you’re asking for a pretty-printer that treats 
keywords differently from other items. Have you looked through all of the 
pretty-print hooks at

https://docs.racket-lang.org/reference/pretty-print.html?q=pretty-print#%28def._%28%28lib._racket%2Fpretty..rkt%29._pretty-print%29%29

?

I’m pretty sure that what you want is not in there, but you should take a look 
anyway.

John


> On Apr 2, 2019, at 3:47 PM, Stephen Foster <step...@thoughtstem.com> wrote:
> 
> Hi all,
> 
> Suppose, I have a datum that represents valid racket code, like '(test #:a a 
> #:b b #: c).  I'd love to render (arbitrarily deeply nested) datums like this 
> to a string that displays like this:
> 
> (test
>   #:a a
>   #:b b
>   #:c c)
> 
> Pretty printing almost works:
> 
> (displayln
>    (pretty-format
>     '(test #:a a #:b b #:c c)
>    24))
> 
> '(test
>   #:a
>   a
>   #:b
>   b
>   #:c
>   c)
> 
> I thought that fiddling with the columns parameter would help, but it doesn't:
> 
> (displayln
>    (pretty-format
>     '(test #:a a #:b b #:c c)
>    25))
> 
> (test #:a a #:b b #:c c)
> 
> Maybe there's some way can get racket/pretty to do what I want -- though I 
> didn't see anything jump out at me in docs.
> 
> I was about to write my own pretty printer, but I figured that with so much 
> stuff out there for typesetting Racket code (e.g in Scribble), I should at 
> least ask if someone knows of something that does what I want: Basically, 
> magically formats datums according to Rackety indentation idioms.  
> 
> Thanks,
> Stephen
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to