I started messing around with literate programming in Racket recently using the Scribble tool. I had a little trouble getting the basic example working, because you need a base Scribble document in addition to the literate program file:
1 2 3 4 5 6 7 |
|
Once this template is set up the main program can be written in
fizzbuzz.scrbl
:
1 2 3 |
|
Finally, to compile with
cross-reference
links correctly it is necessary to use,
scribble +m --redirect-main http://docs.racket-lang.org/ index.scrbl
.
As +m
links against local documentation by default --redirect-main
is
used to point to the main racket site.
Here’s the final output.