From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.devel Subject: Re: inverse of add-to-list: remove-from-list Date: Tue, 13 Oct 2020 16:07:18 -0400 Message-ID: <20201013200718.2xkjcbf7e2xgfui2@E15-2016.optimum.net> References: <20201013193400.uqm2ng6rgfnsei2w@E15-2016.optimum.net> <871ri1x5dd.fsf@igel.home> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25727"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: NeoMutt/20180716 Cc: Emacs-Devel List To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 13 22:10:23 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSQcp-0006br-DG for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Oct 2020 22:10:23 +0200 Original-Received: from localhost ([::1]:58242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSQco-00069M-8f for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Oct 2020 16:10:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSQa1-0004ZW-9c for emacs-devel@gnu.org; Tue, 13 Oct 2020 16:07:29 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:53963) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSQZx-0005OW-Bq for emacs-devel@gnu.org; Tue, 13 Oct 2020 16:07:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1602619641; bh=GLFZxOQUlGa5Tb4ZfDp57AEDUTjPC7PF1apwFfAhCZs=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=NzwGlHP1ElD8GRsZz5pTPuCXOlLitnp9TYGMtplIYuSNsmb8IwAofBJOfHck7Gn8C ranAm0EHtB521feKCLfb8KR/iH9QwPUWH4sIAZa1eA+KCtRE8y47/HX77ZRORNOXg1 ZWJwmFR/2R0sFGr0/x6fFDxpj1VDW+It3ifIb15c= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from E15-2016.optimum.net ([72.89.170.172]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1Ml6m4-1k3IQP1wqq-00lZE1; Tue, 13 Oct 2020 22:07:21 +0200 Content-Disposition: inline In-Reply-To: <871ri1x5dd.fsf@igel.home> X-Provags-ID: V03:K1:hb/dtmAAFEuA5Gt/kXLiGgSq20MqYib1YATmoKtrTy7AU2noC+v BbUuuFBGhq3gMdUmNpEDgdAnjHCGvdPp4Wp0QQMkYgbnE957pAAezdnp0yX6xUxAGajpkkQ QqLdC1PSmxo5G8QYbU7UtvklyU4LcIBv6cp0ACPbH8bYHwLyFq8jpXH0EFLtwXocWb9kp+O DEcIjDVbQ02gKUmIAe7Xw== X-UI-Out-Filterresults: notjunk:1;V03:K0:Ng195mlZeeE=:7/Nt7jPuU8TwEj7Qa1UlaC snrd0uF8XkupHE/PQ23XoeUekcOPw20FZapAIIx/bLuQqniKs27MTbmSDjHakAg5CwX8vio1s GykN/Q5QEdmuyUqEil107BeaEsJ2eo0XrMG0w3QaAkVqPteAYqR7glsXiyqHYiAwLlp2Dlbwi CTwyEOT/5B/JQ6kouYjnwuKILcZSuoBxqnbw8wwhGHHKILrAqMxqgbzV9Xe76tHGB84kxQWZw FHhvaUQq6dZeKzp6mY0j0g6YlG93OlUFWfdI9jAIDNDur8O2HzkPqL02WIOm1f686XtApe57o Yn8k9CBtZ81EXMnFld5YL+f6RPKB/r5CP1fW4OSfMChbD41ZNGxfo2uQZ4OLMjS1pLYF/5qwp GWZmRIth88gDWI2n63f83KlOa12n3fS8F38UKRcjEqg88yLMVrhMS8dAsRQzH0ulw3wK2P4jy C55y8MUOcbz///02J+NZAuxd4iXGduP8yqASANaTCrOzLFAbpJD+xDyKNAMc3fjaPBszwnFAS ZRbQrOokMsPi0LjEj0f+iTvoV4u8U1XPGbabymTW6JY6FMvntv+pFz4TaISfxBDm8J5lA313T oO2HOvmsT2HbBxLkzmxW1GBfxvgLW8YAILuBsm2Fs6whbVAr6P68Y6jB3WbyYP5rzowl1RL+8 CBwAvwT405jb3N9X+rEskeT6OYiG3lt8cTySms9kREAOw3q/z85adqANbQj82/lMjx4bOR5Gw ViA3Nl5iWbQZQ5ZHPSAcfOJrvMa5HKTi1BpVdpL7rzGV6BU2rn27KPbBMEPuCIGZIOB4tOK0 Received-SPF: pass client-ip=212.227.17.22; envelope-from=boruch_baum@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/13 14:39:53 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:257576 Archived-At: On 2020-10-13 22:01, Andreas Schwab wrote: > On Okt 13 2020, Boruch Baum wrote: > > >> On Okt 13 2020, Uwe Brauer wrote: > >> > But there is, as far as I know, no inverse functionality > > > > 1] Similar to what Andreas suggested, try this: > > > > (let ((aa '(1 2 3 1 4 1 2))) > > (delete 2 aa) > > aa) > > > > And note that the fine distinction made in the docstring for the > > `delete' function: > > > > "If SEQ is not a list, deletion is never performed destructively; > > instead this function creates and returns a new vector or string= . > > > > Write =E2=80=98(setq foo (delete element foo))=E2=80=99 to be su= re of correctly > > changing the value of a sequence =E2=80=98foo=E2=80=99. > > > > So, in the case of SEQ being a list, there is no need to `setq foo'= . > > This is not true. Oops. You're correct... > If the element to delete is the first element of the list, it returns > the cdr of the list. ... but to quibble, that's not exactly what I'm getting (let ((aa '(1 2 3 1 4 1 2))) (delete 1 aa) aa) returns (1 2 3 4 2), so it seems to destructively modify the cdr of the list. =2D- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0