From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.help Subject: Re: Setting the nth element of a list Date: Fri, 5 Jun 2009 00:35:06 +0200 Message-ID: References: <8a7c4d36-195d-4517-827e-7fbeca7ae03f@r34g2000vba.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1244168552 17672 80.91.229.12 (5 Jun 2009 02:22:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Jun 2009 02:22:32 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: =?UTF-8?B?Tm9yZGzDtnc=?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 05 04:22:30 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MCP4e-0002SK-AS for geh-help-gnu-emacs@m.gmane.org; Fri, 05 Jun 2009 04:22:30 +0200 Original-Received: from localhost ([127.0.0.1]:54759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MCP4c-0001yC-St for geh-help-gnu-emacs@m.gmane.org; Thu, 04 Jun 2009 22:22:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MCNYJ-0006HM-Oj for help-gnu-emacs@gnu.org; Thu, 04 Jun 2009 20:44:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MCNYF-0006EI-1C for help-gnu-emacs@gnu.org; Thu, 04 Jun 2009 20:44:59 -0400 Original-Received: from [199.232.76.173] (port=52860 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MCMQ8-0006wb-UR for help-gnu-emacs@gnu.org; Thu, 04 Jun 2009 19:32:28 -0400 Original-Received: from mail-bw0-f209.google.com ([209.85.218.209]:49895) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MCLWd-0004yM-Ga for help-gnu-emacs@gnu.org; Thu, 04 Jun 2009 18:35:07 -0400 Original-Received: by bwz5 with SMTP id 5so1204500bwz.42 for ; Thu, 04 Jun 2009 15:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=pztQG+N6laTskUM4Lt1ZtpzvIlSGPafEzyV55HF8oWo=; b=XjLRx8ez/R1KC5v30ih+ClGLy4YgVlnmx1S5P+m02C+Raucpn+z2t+HvPVb+fK0RRv 7UGZ46y1OKEqoybm3gFCjDgdi4DYH45QOufhxY94yyrrQK3ytN8ftdHDOP0f78YuYm4E wdXIb4z7xaPzqKEAgmhHixp6w0NcCwUf/bBrY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=gpT13FgFaCBfuY9amsTiwDo1RXLVZmlv7rvml2dQyGuKIZpGM5g6P0t9r9poEYjrQA T+4HPg2ayRNbhBzxsWHgCqXmgVIleJnhv87h8cfgNkqDJ+LTNmHUNzxEiUOa2AzKQmcf mAsKC9pAitV1dg1MGDuHfuvv6BOKhY6Vb/apk= Original-Received: by 10.239.164.83 with SMTP id s19mr196556hbd.110.1244154906410; Thu, 04 Jun 2009 15:35:06 -0700 (PDT) In-Reply-To: <8a7c4d36-195d-4517-827e-7fbeca7ae03f@r34g2000vba.googlegroups.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:64953 Archived-At: Use nthcdr On Thu, Jun 4, 2009 at 11:08 PM, Nordl=C3=B6w wrote= : > This simple example changes the second element in the list x: > > (setq x '(a nil c)) > (setcar (cdr x 'b) > > How do I generalize this to a function that sets (changes) the nth > element of a list (for side effects only)? > > Thanks in advance, > Nordl=C3=B6w >