No, that doesn't work for me either. Anyway, I was hoping I could export f and then run the examples in a second file (because we have to lp-include the literate program anyway):
;; lp.scrbl #lang scribble/manual @require[scribble/lp-include] @require[scribble/eval] @lp-include["example.rkt"] @examples[(f 10)] On Sun, Dec 14, 2014 at 4:59 PM, Joel McCracken <mccracken.j...@gmail.com> wrote: > > I have tried a few different things. In you case, I think adding a: > > @chunk[ <foo> (provide f)] > > ... will make lp-test work. > > I'm still can't get lp.rkt to become self-referential, though. > > > > On Sun, Dec 14, 2014 at 4:46 PM, Benjamin Greenman <bl...@cornell.edu> > wrote: > > I tried and failed to figure this out. In particular, when I create the > > example "lp.rkt" file described at the top of the scribble/lp docs and > > require it "in the normal manner", the identifier f is unbound for me. > > > > The code I'm using is pasted below: > > > > ;; lp.rkt > > #lang scribble/lp > > > > Literate programs have chunks of code, like this one: > > > > @chunk[<f> > > (define (f x) > > <fs-body>)] > > > > and this one: > > > > @chunk[<fs-body> > > (* x x)] > > > > that, when assembled, produce a complete program, in this case: > > > > @racketblock[(define (f x) > > (* x x))] > > > > ----- > > > > ;; lp-test.rkt > > #lang racket > > (require "lp.rkt") > > (f 3) ;; Error! > > > > > > > > On Sun, Dec 14, 2014 at 2:24 AM, Joel McCracken < > mccracken.j...@gmail.com> > > wrote: > >> > >> I'm trying to create a document that includes code, describes that > >> code, includes example usage, and exports some of the bindings so that > >> it may be included later. > >> > >> I've been looking at the scribble documentation, and it seems like all > >> this should be possible. I can't seem to figure out how to actually > >> run examples. Here's what I have: > >> > >> #lang scribble/lp > >> > >> @(require scribble/eval) > >> > >> This would be a wonderful way to accomplish things! > >> > >> @chunk[* > >> (define (f x) > >> <f-body>)] > >> > >> @chunk[<f-body> > >> (* x x)] > >> > >> > >> And then, I could show an example: > >> > >> @examples[ > >> (f 10) > >> ] > >> > >> > >> Any advice would be really appreciated. > >> ____________________ > >> Racket Users list: > >> http://lists.racket-lang.org/users >
____________________ Racket Users list: http://lists.racket-lang.org/users