[racket] scribble defproc formatting question

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Tue May 1 08:18:40 EDT 2012

Laurent wrote at 05/01/2012 07:30 AM:
> FWIW, the docs for defform say:
> "The typesetting of form-datum, subform-datum, and contract-expr-datum 
> preserves the source layout, like racketblock 
> <http://docs.racket-lang.org/scribble/scribble_manual_code.html?q=defthing#%28form._%28%28lib._scribble/manual..rkt%29._racketblock%29%29>."

Thank you.  I spent some extra time on this unpaid work because I wanted 
to give the kids a good demonstration of why it is important to remember 
that documentation often answers questions.

Incidentally, the workaround for my problem was this:

(define (datum->pretty-syntax datum
                               #:source-name (source-name #f)
                               #:columns     (columns       80))
   (let ((in (open-input-string
              (let ((os (open-output-string)))
                (parameterize ((pretty-print-columns               columns)
                               (pretty-print-depth                 #f)
                               (pretty-print-exact-as-decimal      #f)
                               (pretty-print-.-symbol-without-bars #f)
                               (pretty-print-show-inexactness      #f))
                  (pretty-write datum os))
                (get-output-string os)))))
     (port-count-lines! in)
     (read-syntax source-name in)))

Neil V.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120501/07543d51/attachment.html>

Posted on the users mailing list.