[Top][All Lists]

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

Re: setcdr question

From: Nicolas Richard
Subject: Re: setcdr question
Date: Tue, 02 Jul 2013 11:06:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

drain <> writes:

> (setq list '(Trevor Jason John Alex Max))
> (setcdr (nthcdr (1- 4) list) 'Christina)

As your question was already answered, I allow me to digress slightly
in suggesting that you may like setf for such operations:

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


reply via email to

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