From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: steve-humphreys@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Appending to a list Date: Sun, 13 Dec 2020 22:41:46 +0100 Message-ID: References: <877dpljtwg.fsf@fastmail.fm> 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="22513"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Joost Kremers Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 13 22:44:24 2020 Return-path: Envelope-to: geh-help-gnu-emacs@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 1koZAG-0005kv-FR for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 22:44:24 +0100 Original-Received: from localhost ([::1]:44648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koZAF-0003Sb-Eg for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 16:44:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koZ7v-00029q-2m for help-gnu-emacs@gnu.org; Sun, 13 Dec 2020 16:41:59 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:58863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koZ7n-0004qk-5a for help-gnu-emacs@gnu.org; Sun, 13 Dec 2020 16:41:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607895706; bh=tkRmLTLFiymwUYCxfsnw/B/M59vQ9ylsDyXpzVjKvRU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=CbCelMNdM5wC7fkLeCkA+wxtneZe46kcw0kuQH90y7/jqWC9MuZq3c4JTpZ/Amyvj dzc3Yre4Kn/5SuZuM0HZcHOri56GxIJcSHXGFJ0JZr9DnN60sri1MqmsMM5LoStw/V POFWy3bQohtJZ5JA9weeY1jmivGcYCmlKyUIKits= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs09.server.lan [172.19.170.177]) (via HTTP); Sun, 13 Dec 2020 22:41:46 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <877dpljtwg.fsf@fastmail.fm> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:7bJI4+1kE8QvK0kE6jqpMn4IQ9/Rp0tNkmWeAC478uFUJkBOyTPCT1F46in5Wc1hHKeKr jnuNYPPzsmPWnyUzO51ojmgkShKUD2P2sR6Wqfl4c0+QF45Z09aBHxxd7TZb6UTDDA5ygQ6YiiLG 73qoophoK2bz38FYL4P4VPSD2lrKWEngycfA26BYjcw7v6KBWvJxlKoySt6+I2HzcbH7OEcTjdec splSlJTAVHHeZIlKo08yJukVq5QKIit93ln925VvvwHeEFlF8tFAzDFyK9yriwUu8wAR1qUy4YwJ XU= X-UI-Out-Filterresults: notjunk:1;V03:K0:IXEOeHq9xZs=:W1Eljg9DGB/RfaiLIVPzym 7b+bIyx7cHozWNWdaBGYqexWc6TibpBpLN8+xx0ygy6cEmpRU6XqszbZz05WprIjJVD760lsm rMQt7jcPQ7WYCkFlZBvZhiqGSliECqanugc1EOsVb9gbRK10rixJ+GMDpOySroZX7kfiQ6nNZ /OlyFr/Xb+DPb3ajej+89kDa1Chcdo4Q9b3/4oBB4aKp1B5WX6q4aRBhmZUJ63fX6IceaBfhO cwSh18OVtJcb1ldZ8nSNHiQnZ7TAoTlz1iIxA5iBDO5BbSlzYFH/7kn+FeweEM9LJKCTYk1se LZtJPdfIkDEYdFBahaGtx6aj1W193b8M7QIrYtQ/w7u6IFJEyw1yP9I9bw5vE8X3jpOvp8/ih wqnPu7bo0gtVZuJTOTX9VDkbQmDGOVdE6lax+NGh64oAxNUsO/fepdWToAqdcQ1YK/9ANV+4q nDtsIdzUogh3O5K7xu+BaZZvYbLj7UTz8KGZQGZioZkWbUD6XqOG1A8zjYnXQWbFSI3Y/QTBS nMtFV1OmXbvnQTaQhlX6nXdUkae0To+zKtrIJvM4rzOG0s+K0zMnBA9uVVUNC2ywRu8/HUqX1 V4/A3+df3v4Gc= Received-SPF: pass client-ip=212.227.17.20; envelope-from=steve-humphreys@gmx.com; helo=mout.gmx.net 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: 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126327 Archived-At: > Sent: Sunday, December 13, 2020 at 10:03 PM > From: "Joost Kremers" > To: steve-humphreys@gmx.com > Cc: help-gnu-emacs@gnu.org > Subject: Re: Appending to a list > > > On Sun, Dec 13 2020, steve-humphreys@gmx.com wrote: > > Would appending to list like this be good? > > > > (setq bird '("Toucan" "King Fisher")) > > (setq bird (append bird ("Swift") )) > > This should result in an error, because `("Swift")` isn't quoted. You'd = need: > > (setq bird (append bird '("Swift"))) > > But note that the last argument of `append` isn't copied, so it may not = be a > good idea to use a literal list. > > > Or does one customarily use other constructs for > > adding to a list? > > `push` is what I would use: > > (push "Swift" bird) > > No need to use `setq` here. > > `push` won't check if the element is already in the list, though. You ca= n use > `cl-pushnew` in that case, but be sure to load the library it's in: > > (require 'cl-lib) > (cl-pushnew "Swift" bird) It won't be already in the list. Basically I just want to push entries that are themselves lists, and just go with push push push ... That was very helpful Joost. > HTH > > -- > Joost Kremers > Life has its moments > >