[racket] Scribble: requiring an LP from another LP
I'm new to Scribble and I'm running into some problems splitting my
literate program across multiple files.
The documentation says an rkt file with a "#lang scribble/lp" can be
required from another Racket program like any other rkt file. That works
fine, but requiring one scribble/lp from another doesn't seem to work. In
particular, functions defined in the dependent scribble/lp aren't available
to @chunks in the referencing scribble/lp, even when they're explicitly
exposed via (provide ...).
To clarify, here's an example involving a few files placed in the same
directory.
;; FILE: main.scrbl
> #lang scribble/base
> @require[scribble/lp-include]
> @lp-include["prelude.rkt"]
> @lp-include["chapter1.rkt"]
>
;; FILE: prelude.rkt
> #lang scribble/lp
> @chunk[<prelude>
> (provide atom?)
> (define atom?
> (lambda (x)
> (and (not (pair? x)) (not (null? x)))))]
>
>
;; FILE: chapter1.rkt (fails to access the Prelude's definition of "atom?")
> #lang scribble/lp
> @require["prelude.rkt"]
> @chunk[<atom?-test>
> (define atom-test (atom? 1))]
>
>
;; FILE: prelude-lib-test.rkt (successfully accesses "atom?")
> #lang racket
> (require "prelude.rkt")
>
(define atom-test (atom? 1))
In prelude-lib-test.rkt atom-test evaluates to #t as expected. However,
when I try to evaluate atom-test from chapter1.rkt I'm met with this error:
atom-test: undefined;
> cannot reference an identifier before its definition
Is there something else I should try, or is requiring LPs from LPs like
this not currently supported?
Cheers,
Jake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141124/cff2dfb1/attachment.html>