karttu@walrus.megabaud.fi (Antti Karttunen) writes:
> How do I recreate the effect of dirty macro basque given in
> defmac1.scm using only define-syntax ? That is, I need the free
> reference to B inside the macro body/template to refer to the
> closest lexically enclosing binding of B [in the macro use]
You don't. There are devious ways to write unhygienic macros with
syntax-rules, but you can't break referential transparency. You'll
probably have to pass B as an argument to basque. If you provide some
detail about why you don't want to do that, then perhaps someone can
propose a solution appropriate to the situation.
> (define B '((humpty . dumpty) (tilleri . talleri) (pilleri . hilleri)))
>
> (define-syntax basque
> (syntax-rules ()
> ((basque arg)
> (assq arg B))))
>
> (define (test_it W)
> (let ((B '((tilleri . tyllero) (humpty . hummingbird) (pilleri . pallero))))
> (basque W)))
The sick and fragile solution would be to redefine let so that it
pseudo-unhygienicly binds basque to a macro that refers to the B that
let is binding.
-al
|