[racket] using scribble/eval in conjunction with scribble/lp

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Dec 15 20:15:52 EST 2014

At Mon, 15 Dec 2014 15:49:38 -0700, Matthew Flatt wrote:
> Meanwhile, I'll work on changing `scribble/lp` so that a module
> implemented with `#lang scribble/lp` can be passed directly to
> Scribble.

That turned out to be `scribble/lp2`, since the changes would be
incompatible with existing uses of `scribble/lp`.

With the development versions of the "drracket" and "scribble"
packages, and with the program below, you can click "Run" to run the
program and interact with `f`, or you can click one of the "Scribble"
buttons to render the document.


#lang scribble/lp2
@(require scribble/base

@title{An Example}

This would be a @bold{wonderful} way to accomplish things!

        (define (f x)

        (* x x)]

And then, I could show an example:

   (require syntax/location)
   (define here (quote-source-file))
   (define evaluator (make-base-eval))
   (evaluator `(begin 
                (dynamic-require '(file ,here) #f)
                 (module->namespace '(file ,here))))))

        #:eval evaluator
        (f 10)

Posted on the users mailing list.