[racket] Using Scribble to evalute code blocks in different runtimes
At Fri, 18 Nov 2011 16:19:22 -0300, Eric Tanter wrote:
> You should require both evaluation and sandboxing:
That's right for evaluation within Racket, but I think the question was
about calling external programs (that happen to implement other Lisp
dialects).
Here's an example that uses `system' and `verbatim' to show output from
`csi':
#lang scribble/base
@(require racket/system)
@(define (show-system command [input ""])
(define s (open-output-string))
(parameterize ([current-output-port s]
[current-input-port (open-input-string input)])
(system command))
(verbatim (get-output-string s)))
@show-system["csi -p '(+ 1 2)'"]
> 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