From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: Adding Lists/Sequences Date: Tue, 23 Sep 2008 22:48:46 +0200 Message-ID: <87od2ebnbl.fsf@thievol.homelinux.org> References: <3b97cca7-1c31-4e07-ba09-f0aeca96019c@34g2000hsh.googlegroups.com> <873ajqackk.fsf@hubble.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1222203007 24168 80.91.229.12 (23 Sep 2008 20:50:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Sep 2008 20:50:07 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: pjb@informatimago.com (Pascal J. Bourguignon) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 23 22:51:04 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KiEqZ-0004tU-5L for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Sep 2008 22:50:59 +0200 Original-Received: from localhost ([127.0.0.1]:37407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KiEpX-00005E-8d for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Sep 2008 16:49:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KiEpA-0008Vc-C7 for help-gnu-emacs@gnu.org; Tue, 23 Sep 2008 16:49:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KiEp9-0008VO-GV for help-gnu-emacs@gnu.org; Tue, 23 Sep 2008 16:49:32 -0400 Original-Received: from [199.232.76.173] (port=58251 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KiEp9-0008VK-9M for help-gnu-emacs@gnu.org; Tue, 23 Sep 2008 16:49:31 -0400 Original-Received: from fg-out-1718.google.com ([72.14.220.155]:50849) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KiEp9-0001Ti-5N for help-gnu-emacs@gnu.org; Tue, 23 Sep 2008 16:49:31 -0400 Original-Received: by fg-out-1718.google.com with SMTP id l26so2020695fgb.30 for ; Tue, 23 Sep 2008 13:49:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=DvXCpC+oMfZz3Sgk7xYg5ZrCvCGv2jVbSCn01bpKSSQ=; b=RhjtpbIcQljaxAy2Eii4vSp+LRx/IOOZfkUEVxKm04Q5XWM0x6Z9vHFDHBNbGc4OYJ UzQgQg9OVdVgGFYFteT+UANXxY3PO61KQUoJUWmnkE7di2LBq9MKxIozvTAmnTok1UeE oq3zVGiPNGYUwG+cGwtAS1uQrOQTGBUkwu7e8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; b=u9tUZyVLzKNxNiAGX57Kp3fZzRwrKketW0X+jb+/ieDq5vmf5KIwsAjUQthmATL0YY XbIFrobjSN0i8q/Ax4vlNC8ZOayGM+JfSmNb0LTUdLYz37dWcuIu3Yx7suhQJjHtkY7Q hKMpvO4uEcCGXuGY7n8fLjcL3KOQhYiHskj8k= Original-Received: by 10.181.21.2 with SMTP id y2mr4368065bki.44.1222202367604; Tue, 23 Sep 2008 13:39:27 -0700 (PDT) Original-Received: from thievol.homelinux.org (9.77.197-77.rev.gaoland.net [77.197.77.9]) by mx.google.com with ESMTPS id 28sm2041057fkx.1.2008.09.23.13.39.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 23 Sep 2008 13:39:20 -0700 (PDT) In-Reply-To: <873ajqackk.fsf@hubble.informatimago.com> (Pascal J. Bourguignon's message of "Tue, 23 Sep 2008 21:26:19 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:57973 Archived-At: pjb@informatimago.com (Pascal J. Bourguignon) writes: > Thierry Volpiatto writes: > >> Nordl=C3=B6w writes: >> >>> Is there a general function, say foo, that adds lists or, even better, >>> sequences together? >>> >>> I want this >>> (foo '("a" "b") '("c" "d")) >>> to evaluate to >>> '("a" "b" "c" "d") >> >> ,---- >> | ELISP> (nconc '("a" "b" "c") '("d" "e" "f"))=20 >> | ("a" "b" "c" "d" "e" "f") >> `---- > > Very bad! > > (defun bad-bad (tail) > (nconc '(a b c) tail)) > > (bad-bad '(1 2 3)) --> (a b c 1 2 3) > (bad-bad '(4 5 6)) --> (a b c 1 2 3 4 5 6) ; !!! > > NEVER use a destructive function on literal data! Good tip, Thank you. > >> Note: `append' is not destructive > > append is much better, but be careful that it shares the tail, so you > must consider the result as a literal data, unless you have consed the > tail yourself. --=20 A + Thierry Volpiatto Location: Saint-Cyr-Sur-Mer - France