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

From: Grant Rettke (grettke at acm.org)
Date: Sat Nov 19 11:26:22 EST 2011

Thanks Matt and Eric.

On Sat, Nov 19, 2011 at 10:12 AM, Eric Tanter <etanter at dcc.uchile.cl> wrote:
> Sorry I misunderstood the question. `show-system' below is really useful!
>
> -- Éric
>
>
> On Nov 19, 2011, at 12:09 PM, Matthew Flatt wrote:
>
>> 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
>>
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>
>



-- 
http://www.wisdomandwonder.com/
ACM, AMA, COG, IEEE



Posted on the users mailing list.