[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macroexpansion and (function ...)
From: |
Barry Margolin |
Subject: |
Re: macroexpansion and (function ...) |
Date: |
Thu, 10 Jul 2003 21:59:26 GMT |
In article <457e22d8.0307101349.21a612db@posting.google.com>,
Faried Nawaz <fn@hungry.com> wrote:
>However, this produces weird results:
>
>(for-each
> (lambda (triglist)
> (trigger-register
> (first triglist)
> (second triglist)
> say-something
> (third triglist)))
> '(("trig2" "[Xx]emacs" "you said xemacs!")
> ("trig3" "vi" "vi vi vi")))
>=> nil
>
>trigger-table
>=> (("trig3" (lambda nil (say-something (third triglist))) "vi")
> ("trig2" (lambda nil (say-something (third triglist))) "[Xx]emacs")
> ("trig1" (lambda nil (say-something "you said emacs!")) "[Ee]macs"))
>
>Why do I have (third triglist) in there instead of the messages?
Macros don't evaluate their arguments. A macro's expansion can't depend on
runtime data, because macros will be expanded by the compiler.
--
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.