help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: never use `eval' (was: Re: How to mapcar or across a list?)


From: John Mastro
Subject: Re: never use `eval' (was: Re: How to mapcar or across a list?)
Date: Wed, 15 Jul 2015 17:18:14 -0700

>> I would use something like this:
>>
>> (defmacro ...
>
> Macros never liked me, and that is mutual. Are they
> really preferrable to `eval'?

Yes, I think so. I certainly don't see any advantages to `eval' where a
function or macro would work.

> This is what it looks like:
>
>     (eval `(create-book nil ,title ,@data))
>
> With `apply', won't the last "data" be a list, i.e.
>
>     (a b ... n)
>
> instead of
>
>     a b ... n

No, that's `funcall'. For example, these both evaluate to 6:

(apply #'+ '(1 2 3))
(apply #'+ 1 2 '(3))

-- 
john



reply via email to

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