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: Barry Margolin
Subject: Re: never use `eval' (was: Re: How to mapcar or across a list?)
Date: Wed, 15 Jul 2015 20:04:23 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.6984.1437004760.904.help-gnu-emacs@gnu.org>,
 Emanuel Berg <embe8573@student.uu.se> wrote:

> John Mastro <john.b.mastro@gmail.com> writes:
> 
> > I would use something like this:
> >
> > (defmacro ...
> 
> Macros never liked me, and that is mutual. Are they
> really preferrable to `eval'?
> 
> > For this (and others like it)
> 
> ... which are? Do you mean the eval + backquote combo?
> 
> > it looks like you could instead simply use e.g.
> > (apply #'create-book nil title data)
> 
> 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. apply spreads its last argument. You're thinking of funcall.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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