[racket-dev] scribble interaction
It's not the default because most examples don't need pretty printing,
and initializing a sandbox with the pretty printer takes twice as long.
At Sun, 28 Aug 2011 12:05:51 -0400, Matthias Felleisen wrote:
>
> Shouldn't the pretty-print version be the default one? How often would I want
> to write documentation that doesn't pretty print?
>
> -- Matthias
>
>
>
> On Aug 27, 2011, at 4:07 PM, Matthew Flatt wrote:
>
> > At Sat, 27 Aug 2011 13:22:12 -0400, Matthias Felleisen wrote:
> >>
> >> When you run this program, you don't get the pretty printing you get in
> plain
> >> Racket or in Dr. Why?
> >
> > The default evaluator for `interaction' is analogous to
> >
> > racket -l racket/base -i
> >
> > where `pretty-print' isn't installed as the printer.
> >
> > The example below illustrates how to install pretty printing into an
> > `interaction' sandbox.
> >
> > ----------------------------------------
> > #lang scribble/manual
> >
> > @(require scribble/eval)
> >
> > @(define ex-eval (make-base-eval))
> > @(interaction-eval
> > #:eval ex-eval
> > (begin
> > (require racket/pretty)
> > (current-print pretty-print-handler)))
> >
> > @interaction[
> > #:eval ex-eval
> > (define (f x)
> > `(,(build-list x add1)
> > ,(build-list x add1)))
> > (f 20)
> > ]
> >
> > @(close-eval ex-eval)
> >