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

From: Joel McCracken (mccracken.joel at gmail.com)
Date: Tue Dec 16 13:28:58 EST 2014

Forwarding to users, since I forgot to reply-all.


---------- Forwarded message ----------
From: Joel McCracken <mccracken.joel at gmail.com>
Date: Tue, Dec 16, 2014 at 1:27 PM
Subject: Re: [racket] using scribble/eval in conjunction with scribble/lp
To: Matthew Flatt <mflatt at cs.utah.edu>


Hmm, I'm having trouble finding this new release of Racket that will
allow a #lang scribble/lp2 -- I'll keep looking later. This is awesome
though, thank you for the prompt response!

On Mon, Dec 15, 2014 at 8:15 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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
>           scribble/eval)
>
> @title{An Example}
>
> This would be a @bold{wonderful} way to accomplish things!
>
> @chunk[<*>
>         (define (f x)
>           <f-body>)]
>
> @chunk[<f-body>
>         (* x x)]
>
>
> And then, I could show an example:
>
> @(begin
>    (require syntax/location)
>    (define here (quote-source-file))
>    (define evaluator (make-base-eval))
>    (evaluator `(begin
>                 (dynamic-require '(file ,here) #f)
>                 (current-namespace
>                  (module->namespace '(file ,here))))))
>
> @examples[
>         #:eval evaluator
>         (f 10)
> ]
>

Posted on the users mailing list.