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:46:09 +0100
Message-ID: <trinity-ea4682d5-084a-4ff9-af1e-9752014e5ced-1607895969917@3c-app-mailcom-bs09>
References: <trinity-e1461f6e-8385-4745-a51a-4b1ba0a4f65b-1607892417691@3c-app-mailcom-bs09>
 <877dpljtwg.fsf@fastmail.fm> <87sg89v1f7.fsf@telefonica.net>
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="33502"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: help-gnu-emacs@gnu.org
To: =?UTF-8?Q?=C3=93scar_Fuentes?= <ofv@wanadoo.es>
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 13 22:46:44 2020
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1koZCW-0008d0-Au
	for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 22:46:44 +0100
Original-Received: from localhost ([::1]:53350 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1koZCV-0007FK-Bz
	for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 16:46:43 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59722)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <steve-humphreys@gmx.com>)
 id 1koZC5-0007DE-Sx
 for help-gnu-emacs@gnu.org; Sun, 13 Dec 2020 16:46:17 -0500
Original-Received: from mout.gmx.net ([212.227.17.20]:58403)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <steve-humphreys@gmx.com>)
 id 1koZC0-0006gO-4E
 for help-gnu-emacs@gnu.org; Sun, 13 Dec 2020 16:46:17 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1607895970;
 bh=EDl1HwE6sOkg972GBSD2gs36eB0A2Bpbd92lTQO5tME=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;
 b=fWdsNtOL9kiYO75ct63M7RejHoDwaqIt4W/qxeL2wXptJT8WaBjbfWdARCXbvd1L/
 By+3gNE1TkeEPHovKa6efnFqWfFrS1W/LR3CseqVgDF99sZsMjHFH/Y27Xdzh0hiby
 DixhrzflNZJ7XvFHy3b06aiVj6oSOSCeHmUoafus=
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:46:09 +0100
Importance: normal
Sensitivity: Normal
In-Reply-To: <87sg89v1f7.fsf@telefonica.net>
X-UI-Message-Type: mail
X-Priority: 3
X-Provags-ID: V03:K1:pXqxsnmom9MO8wuc9xJWukk0U1J0olOtjS6JJMd3OqJrMQ8+GmSVVp/iOSonlBZKhH2XM
 /G3Lc7Uz0eJFnRkqTokwMRS7yTJckGN2m4XTi7YRE8c7AdTi7ifjUg5PEC4VBVj3wOiWG7S7u63u
 v3Fd1TrZTxWzOOdHvxyB2KNsAjEuX5KMuyXs3ferctMyvCo7MharodWTilQfUSCYKPKY9CE2Zoyi
 glMjTQnB9isREhOJnK0o3RsTy9rl94mY0jm6+toBu9T21+X14yzSDTVPlOLSGEql1grevJ5Glj4W
 Dk=
X-UI-Out-Filterresults: notjunk:1;V03:K0:sKUpyG/8VXE=:jgzKILJSL/9RMbwk46EPjV
 JtfXrXp6bqTwATG9GEKxX8/W4ZL5p7WgRXy9yd0KZwYTucDkaqbbm4uRYtEX+lXvxyPamamv7
 63w8CuQ4qWBwT14WCNmh2M3XCp6oJuHsq3gcL50saudvEreOLh9IaN0jMjxct3W01EXMQaobF
 EAhTTduv++sjSBlyLEcVvSavhp1LzatmVa4X/F+mwZs59oq8l8Pte9nVUEx5pWupNoW2fVP8e
 RuHcWUx/ebsHyBVtrBaQjOV4vOONSISAAX6Izlh3oqlnadG14h91C7leJteVEpS3UNg3GHYIL
 Tjo5Ipz7Hu+1yIDpK9NOWV1NKUffVV5hZ0xSGo4tYYn77LY9PH9SjALxC5o5hNqRBPwA0uTZV
 ENw+Ll0jtE8vHTvVM5uawBkJul67iZnV4R0AGIWgvSd1rHNEVNU9Rusn+tzw0LelQ+MeqU+wj
 MX4ZVztzETzG3u2P6CdI0rgas7RnCoyusvfVuJUF9+oosMJodLZOvJjP5vD/rREznOzMrLRuj
 L6qlcikihRbxyBjDdcxvU9MjX7Ghyj6MV20uFYC9d4/XphrtGEHBqBJW99UdFVZ2HcRYqKvr6
 42STKmSRl0UpI=
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 <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "help-gnu-emacs"
 <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
Xref: news.gmane.io gmane.emacs.help:126328
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/126328>






> Sent: Sunday, December 13, 2020 at 10:30 PM
> From: "=C3=93scar Fuentes" <ofv@wanadoo=2Ees>
> To: help-gnu-emacs@gnu=2Eorg
> Subject: Re: Appending to a list
>
> Joost Kremers <joostkremers@fastmail=2Efm> writes:
>=20
> > On Sun, Dec 13 2020, steve-humphreys@gmx=2Ecom wrote:
> >> Would appending to list like this be good?
> >>
> >> (setq bird '("Toucan" "King Fisher"))
> >> (setq bird (append bird ("Swift") ))

Can one just append lists together, then store the result to one of the va=
riables, as I did? =20
Or could such an approach lead to unintended consequences in some circumst=
ances?

Regards
Steve

> > This should result in an error, because `("Swift")` isn't quoted=2E Yo=
u'd need:
> >
> >     (setq bird (append bird '("Swift")))
> >
> > But note that the last argument of `append` isn't copied, so it may no=
t be a
> > good idea to use a literal list=2E
> >
> >> Or does one customarily use other constructs for
> >> adding to a list?
> >
> > `push` is what I would use:
> >
> >     (push "Swift" bird)
>=20
> This does not append=2E
>=20
> > No need to use `setq` here=2E
> >
> > `push` won't check if the element is already in the list, though=2E Yo=
u can use
> > `cl-pushnew` in that case, but be sure to load the library it's in:
> >
> >     (require 'cl-lib)
> >     (cl-pushnew "Swift" bird)
>=20
> Isn't that the same as
>=20
> (add-to-list bird "Swift" t)
>=20
> ?
>=20
>=20
>