From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: Re: Replace element in list Date: Mon, 2 Sep 2019 12:46:35 +0200 Message-ID: <20190902104635.GE1466@tuxteam.de> References: <6a632b18-bbd6-7096-229d-6c890b6bdb6f@easy-emacs.de> <20190902103723.GC1466@tuxteam.de> <20190902104107.GD1466@tuxteam.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PPYy/fEw/8QCHSq3" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="268907"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 02 12:47:00 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i4jrP-0017ro-T7 for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Sep 2019 12:47:00 +0200 Original-Received: from localhost ([::1]:35016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4jrO-0004xd-ET for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Sep 2019 06:46:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58202) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4jr4-0004xL-NR for help-gnu-emacs@gnu.org; Mon, 02 Sep 2019 06:46:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4jr3-0002zN-3z for help-gnu-emacs@gnu.org; Mon, 02 Sep 2019 06:46:38 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:40559) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i4jr2-0002wz-Te for help-gnu-emacs@gnu.org; Mon, 02 Sep 2019 06:46:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date; bh=z6ETOa8Hkm1xeC3Vr5hGaZzysA+FUuxgLBCxJAaMRHU=; b=IY2yHBAddXXsrdh98Uj64i9mBuN+KjMjWLuKjWhhq9koQBM/S1WS6+tSDMV73s3KdeVkKlt2GdCFw00UUmJmt1zJ+zH67QSgP0YV9LszeVFNE2SdO3Ow+K0fU/eHQl/0Gsop7h6bDf2B7UNVCCPCHAxuLEUz3Z6Kj/9lY4j8/JXeLKIn+3BzxMKtQqgHOJRanGfb7Ci1Kp49BuHSPNg1cYVw+oNOE6mfd8fNOMUe9p+Qcdgx45NaMuClOfVdNF9lrko3mszZ8QwgYmoNMAVXWM51YbE4nPQ4YQF1hNwnELQQGA+fpsKKR32QryLuwO05tGOOSSVRoyt4cKRhH4HF1Q==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1i4jr1-0002Iq-7d for help-gnu-emacs@gnu.org; Mon, 02 Sep 2019 12:46:35 +0200 Content-Disposition: inline In-Reply-To: <20190902104107.GD1466@tuxteam.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.199.139.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:121412 Archived-At: --PPYy/fEw/8QCHSq3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 02, 2019 at 12:41:08PM +0200, tomas@tuxteam.de wrote: > On Mon, Sep 02, 2019 at 12:37:23PM +0200, tomas@tuxteam.de wrote: > > On Mon, Sep 02, 2019 at 11:44:10AM +0200, Andreas R=C3=B6hler wrote: > > > Hi, > > >=20 > > > is there a recommended way to replace element x at index i of > > > somelist=C2=A0 y by newelement? > >=20 > > Like this? > >=20 > > scheme@(guile-user)> (define lst (list-copy '(fire water air earth))) > > scheme@(guile-user)> (list-set! lst 2 'mud) > > $3 =3D mud > > scheme@(guile-user)> lst > > $4 =3D (fire water mud earth) >=20 > Oops, sorry. Wrong language, wrong mailing list. Embarrasing. In Emacs Lisp you could try: (setcar (nthcdr 3 foo) 'mud) =2E..but remember, you are leaving the functional sector ;-) Cheers -- t --PPYy/fEw/8QCHSq3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl1s8wsACgkQBcgs9XrR2kb+bACfYy9rAXDR2/cZAJNOg8rwcN5X KNkAnR/3QPWTWk04H28KMAHxOjfPRcHG =89pp -----END PGP SIGNATURE----- --PPYy/fEw/8QCHSq3--