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

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

Re: setcdr question


From: Teemu Likonen
Subject: Re: setcdr question
Date: Tue, 02 Jul 2013 12:17:56 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Nicolas Richard [2013-07-02 11:06:58 +02:00] wrote:

> drain <aeuster@gmail.com> writes:
>> (setq list '(Trevor Jason John Alex Max))
>> (setcdr (nthcdr (1- 4) list) 'Christina)

> (let ((list '(Trevor Jason John Alex Max)))
>   (setf (nth (1- 4) list) 'Christina)
>   list)

In Common Lisp a literal data shouldn't be edited. I suggest adopting
the same practice in Emacs Lisp too. So, create your list with LIST

    (list 'Trevor 'Jason 'John 'Alex 'Max)

or copy a literal sequence before editing:

    (copy-sequence '(Trevor Jason John Alex Max))

Attachment: pgp9wq58baGJV.pgp
Description: PGP signature


reply via email to

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