emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro vs Function


From: Stuart D. Herring
Subject: Re: Macro vs Function
Date: Wed, 12 Apr 2006 08:26:05 -0700 (PDT)
User-agent: SquirrelMail/1.4.3a-11.EL3

> The reason why ,(car largs) is not sufficient is that 'apply' requires
> a list as the last argument. While I call 'xgp-casi2-safe-call-iter' with
>
>     (xgp-casi2-safe-call-iter '+ ((1 2 a) (3 4)))
>
> (car largs) is (1 2 a), which it's not a list when evaluating
>
>     (apply '+ (1 2 a))

This much you can solve simply by using ',(car largs).  In general, in a `:

x              "use literally and eval later"
'x             "never eval at all"
,x             "use symbolically and eval later"
(eval x)       "use literally and eval twice later"
,(eval x)      "evaluate now and later"
',(eval x)     "evaluate now only"
',x            "use symbolically and don't eval later"

(...where 'now' is macro expansion time and 'later' is interpretation
time.)  You want the last one, since largs is a macro argument (use
symbolically) but you don't want the resulting list evaluated.  (I hope I
got all those meanings right!)

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]