[plt-scheme] Problem with a macro inside a module
At Thu, 3 Jul 2003 17:06:00 +0200, Jean-Guillaume Pyraksos wrote:
> ; In a file foo.ss i have the following module:
>
> (module foo mzscheme
> (provide double!)
>
> (define-syntax double!
> (syntax-rules ()
> ((double! x) (set! x (* x 2)))))
>
> (printf "Module foo loaded !~n"))
>
> ; If in the same file i have also:
>
> (require foo)
> (define x 1)
> (double! x)
> x
>
> ; then when evaluating the file it works ok, giving 2.
>
> ; Now, if i save only the module foo in the file and if i type in
> another toplevel window:
>
> (require (file "~/Documents/Scheme/foo.ss"))
> (define x 1)
> (double! x)
> x
>
> ; then it says "identifier double! is not defined".
From what you've written, this should work.
My best guess is that you accidentally saved the module to a file other
than "~/Documents/Scheme/foo.ss" (maybe a different "foo.ss"), but
that's a weak guess.
You're using DrScheme's `Execute' button to evaluate the last four
lines? Which language?
Matthew