In article <87it8db0um.fsf@radish.petrofsky.org>,
Al Petrofsky <al@petrofsky.org> wrote:
...
>
>Are you still with me? Anyone? Anyone?
No, and I don't try to be at 4:38 am.
But I guess this is a good occassion to insert a naive question between:
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
(as when using define-macro in the guile example below),
not to the global definition valid at the time of defining
the macro, as when using define-syntax in the scsh example below.
I guess I will use scsh in my project, but unfortunately
it has only define-syntax, not define-macro.
looper:/home/karttu/macs(11)% guile
guile> (load "defmac1.scm")
guile> (test_it 'humpty)
(humpty . hummingbird)
guile> (exit)
looper:/home/karttu/macs(12)% scsh
Welcome to scsh 0.6.1 (Combinatorial Algorithms)
Type ,? for help.
> (load "defsyn2.scm")
defsyn2.scm
> (test_it 'humpty)
'(humpty . dumpty)
> (exit)
looper:/home/karttu/macs(13)% more defmac1.scm
(define B '((humpty . dumpty) (tilleri . talleri) (pilleri . hilleri)))
(define-macro (basque arg) `(assq ,arg B))
(define (test_it W)
(let ((B '((tilleri . tyllero) (humpty . hummingbird) (pilleri . pallero))))
(basque W)
)
)
looper:/home/karttu/macs(14)% more defsyn2.scm
(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)
)
)
looper:/home/karttu/macs(15)%
Terveisin,
Antti Karttunen
|