From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: Replace element in list Date: Mon, 2 Sep 2019 12:37:23 +0200 Message-ID: <20190902103723.GC1466@tuxteam.de> References: <6a632b18-bbd6-7096-229d-6c890b6bdb6f@easy-emacs.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ABTtc+pdwF7KHXCz" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="233526"; 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:37:51 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 1i4jiY-000yep-LT for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Sep 2019 12:37:50 +0200 Original-Received: from localhost ([::1]:34944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4jiX-00020m-C2 for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Sep 2019 06:37:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56929) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4jiJ-0001xd-28 for help-gnu-emacs@gnu.org; Mon, 02 Sep 2019 06:37:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4jiG-00061W-Gl for help-gnu-emacs@gnu.org; Mon, 02 Sep 2019 06:37:34 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:40538) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i4jiG-0005rm-29 for help-gnu-emacs@gnu.org; Mon, 02 Sep 2019 06:37:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=NGtjNXekjt8CboS2dhmjeGkaiH/Vnut9Ur+vI/HIUC0=; b=vLS21q4dajWYWFgMkigktvzd5kSaV3Eom4A/N3Vuehs2pmz2kFzMMbNunVHqwYq6BikDyAFPDpo33jnEnR3mmEzK98tYj/B/PWFWmknV43iDS7dZeHzpJ6fakNcUplOM6NQhLkdyF/LJ7pYM+jKCRl7QfTO8ELVtMitv22HUsM8u3AG+XlqMkM4hwjsJfk8IGaE9/8remaCPkzV2g1os59aYKRuLbbz7FDMU3H8q4yUG1f1/tyMxFJvb0NUVsRLddCFSYYUhqwk6DrtDwdA744olFO+GIJ5op59MxqbDErRKxgm3gbvi/MYIQ2htKXQZ6te1vwGw6bJR87pKXdsE4Q==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1i4ji7-0002D9-QD for help-gnu-emacs@gnu.org; Mon, 02 Sep 2019 12:37:23 +0200 Content-Disposition: inline In-Reply-To: <6a632b18-bbd6-7096-229d-6c890b6bdb6f@easy-emacs.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:121410 Archived-At: --ABTtc+pdwF7KHXCz Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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? Like this? 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 Note the "list-copy" above. Strange things might happen to your computer if you try to mutate immutable data ;-D Cheers -- t --ABTtc+pdwF7KHXCz Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl1s8OMACgkQBcgs9XrR2ka0vQCfaHqOyhUHCNaBEv28tYviM4tc 9b0An2BKjRK6Ad6kACksFX7mSS0Y+wZS =krA9 -----END PGP SIGNATURE----- --ABTtc+pdwF7KHXCz--