[racket-dev] scribble interaction

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Aug 27 16:07:08 EDT 2011

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)



Posted on the dev mailing list.