[racket] Using Scribble to evalute code blocks in different runtimes

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Fri Nov 18 14:19:22 EST 2011

Hi,

You should require both evaluation and sandboxing:
@(require scribble/eval
          racket/sandbox)

Then define as many evaluators as you need:

@(define ex-eval (make-base-eval))

you can import modules into a given evaluator:
@interaction-eval[#:eval ex-eval (require "foo.rkt")]

and then when you do definitions and interactions, specify the evaluator to use:

@racketblock+eval[#:eval ex-eval
(define MAX 100)
]

@interaction[#:eval ex-eval
MAX
(< 25 MAX)
]

Hope this helps!

-- Éric


On Nov 18, 2011, at 12:56 PM, Grant Rettke wrote:

> Hi,
> 
> My goal is to write a document that shows examples of code running in
> different Scheme runtimes.
> 
> For example I want to show how a code block of Rackunit works in
> Racket, what it gets evaluated to; and then do the same with Chicken's
> test framework, and so on and so forth.
> 
> What is the easiest way to do this?
> 
> Now, I'm going to start reading the documentation for Scribble.
> 
> Best wishes,
> 
> Grant
> 
> -- 
> http://www.wisdomandwonder.com/
> ACM, AMA, COG, IEEE
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
> 




Posted on the users mailing list.