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

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

Re: `append' vs. `nconc'


From: Pascal J. Bourguignon
Subject: Re: `append' vs. `nconc'
Date: Fri, 01 Jan 2016 07:25:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> What is the reason one has to use `list'? (I suppose
> the ` isn't safe, either.)

list returns a fresh list. ` doesn't. ` may return a structure that
shares literal substructures with others.

Typically, it will be a tail, but it can also be some cars:

    `((a . b) (c . ,x) ,@y d e f)

could translate to:

    (list* '(a . b) (cons 'c x) (append y '(d e f)))

or something similar.  Then each time you execute it, you get a list
whose tail is the same literal (d e f), and whose car is the same
literal cons (a . b).


> And: In Pascal's examples he always used `setf'.
> The help says it can be used for places as well as for
> symbols. In the examples tho there has been only
> symbols if I'm not mistaken.

It's simplier to forget about set and setq, and always use setf.
That frees two neurons to think about other things.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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