Just off the top of my head this sounds like a classic phasing error.
The macro is actually expanded in an entirely different context from
its apparent definition. I believe that R6RS has language regarding
whether definitions are to be available at expansion-time or at
run-time in the spirit of the _You Want It When_ paper.

Caveat Coder: I've not looked at R6RS in detail since I cast my ballot
against it. I have a large R5RS code base and haven't really felt the
need...


2009/2/13 Eduardo Cavazos <[email protected]>:
> Hello,
>
> So, I've seen a few "define-macro using syntax-case" implementations
> floating around. This one loads and works for simple cases. But it has
> trouble when you reference non-rnrs-base functions in the body.
>
> For example, this works:
>  > (define-macro (test-macro a) `(list ,a))
>  > (test-macro 10)
> (10)
>
> but this doesn't:
>  > (define (sq n) (* n n))
>  > (define-macro (test-macro-sq a) `(list (sq ,a)))
>  > (test-macro-sq 10)
>
> Syntax violation: invalid reference
> No binding available for sq in library (define-macro)

-- 
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt

_______________________________________________
Larceny-users mailing list
[email protected]
https://lists.ccs.neu.edu/bin/listinfo/larceny-users

Reply via email to