[plt-scheme] scribble/eval - defs+int
At Tue, 27 Apr 2010 22:31:30 -0400, Eric Tanter wrote:
> I'm trying to figure out a way to insert some text in between Scheme
> definitions: that is, have some definitions (@schemeblock or equivalent), with
> their explanations (text mode), and then an interaction, like @interaction,
> except that it should be aware of the preceeding definitions.
>
> I found out about @defs+int but it forces all definitions and the expr to be
> defined in one shot.
>
> What would be the best way to do that?
You need to use `#:eval'. Example below.
----------------------------------------
#lang scribble/manual
@(require scribble/eval)
@(define ex-eval (make-base-eval))
First, we define @scheme[x]:
@interaction[
#:eval ex-eval
(define x 1)
]
Next, we use it:
@interaction[
#:eval ex-eval
x
]
@(close-eval ex-eval)