[racket] Getting started with Scribble

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Mar 16 22:32:21 EDT 2012

What you're asking for is not what Scribble does, mostly speaking.
Running a scribble program just builds a datastructure for the
rendering process.

You might try the scribble/lp library, tho. I think that comes closest.

Robby

On Fri, Mar 16, 2012 at 9:24 PM, Mark Engelberg
<mark.engelberg at gmail.com> wrote:
> This doesn't appear to do what I'm asking.
>
> I tried this as per your suggestion:
>
> #lang scribble/manual
> @(require scribble/eval)
>
> @title{My Scribblings}
> I'm going to write a really amazing factorial function now.
>
> @interaction[
> (define (factorial n)
>    (cond
>      [(zero? n) 1]          ;; The zero test
>      [else (* n (factorial (sub1 n)))]))
> ]
>
>
> But when I hit Run, it doesn't seem to recognize factorial in the
> interactions window.
>
>
> On Fri, Mar 16, 2012 at 6:41 PM, David Van Horn <dvanhorn at ccs.neu.edu>
> wrote:
>>
>> On 3/16/12 8:42 PM, Mark Engelberg wrote:
>>>
>>> So I'm trying to figure out the simplest way to create a document that
>>> is mostly text with a few Racket snippets.  When I hit Run, I want the
>>> code to be evaluated for the interactions window.  When I hit the
>>> scribble button, I want it to generate html that displays the formatted
>>> text along with the Racket snippets.
>>>
>>> First attempt:
>>> Use scribble/base and put an @ in front of any Racket code.
>>> Hitting run evaluates the Racket code, but scribblizing only shows the
>>> formatted text -- the code remains invisible.
>>>
>>> Second attempt:
>>> Use scribble/manual and put @racketblock[] around any Racket code.
>>> Looks great when you scribblize, but code doesn't evaluate.
>>> Another nuisance: IDE auto-converts opening bracket after @racketblock
>>> into a paren.
>>
>>
>> Is this what you're looking for?  -- David
>>
>> #lang scribble/manual
>> @(require scribble/eval)
>>
>> @title{My Scribblings}
>>
>> I don't always program, but when I do, I program in
>>
>> @interaction[(banner)]
>>
>>
>
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
>


Posted on the users mailing list.