all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: Nicolas Richard <theonewiththeevillook@yahoo.fr>
Cc: drain <aeuster@gmail.com>, Help-gnu-emacs@gnu.org
Subject: Re: setcdr question
Date: Tue, 02 Jul 2013 12:17:56 +0300	[thread overview]
Message-ID: <87bo6l48xn.fsf@mithlond.arda> (raw)
In-Reply-To: <87obal1gb1.fsf@yahoo.fr> (Nicolas Richard's message of "Tue, 02 Jul 2013 11:06:58 +0200")

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

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 #2: Type: application/pgp-signature, Size: 835 bytes --]

  reply	other threads:[~2013-07-02  9:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01 22:46 setcdr question drain
2013-07-02  2:12 ` Pierre Lorenzon
2013-07-02  9:06 ` Nicolas Richard
2013-07-02  9:17   ` Teemu Likonen [this message]
2013-07-02 22:17     ` drain
2013-07-02 22:26       ` drain
2013-07-03  9:13       ` Pierre Lorenzon
     [not found]       ` <mailman.90.1372804018.12400.help-gnu-emacs@gnu.org>
2013-07-03 13:04         ` Rustom Mody
2013-07-04 19:19           ` drain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bo6l48xn.fsf@mithlond.arda \
    --to=tlikonen@iki.fi \
    --cc=Help-gnu-emacs@gnu.org \
    --cc=aeuster@gmail.com \
    --cc=theonewiththeevillook@yahoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.