From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Adding Lists/Sequences Date: Tue, 23 Sep 2008 21:26:19 +0200 Organization: Informatimago Message-ID: <873ajqackk.fsf@hubble.informatimago.com> References: <3b97cca7-1c31-4e07-ba09-f0aeca96019c@34g2000hsh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1222198903 9732 80.91.229.12 (23 Sep 2008 19:41:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Sep 2008 19:41:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 23 21:42:38 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 1KiDmN-0006XV-Co for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Sep 2008 21:42:35 +0200 Original-Received: from localhost ([127.0.0.1]:55444 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KiDlL-0007rf-IV for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Sep 2008 15:41:31 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!goblin1!goblin.stu.neva.ru!news.in2p3.fr!in2p3.fr!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp2-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:HYWe4OtgRp3N6AXVsHjM1b8eoEA= Original-Lines: 37 Original-NNTP-Posting-Date: 23 Sep 2008 21:26:19 MEST Original-NNTP-Posting-Host: 88.182.134.169 Original-X-Trace: 1222197979 news-2.free.fr 14753 88.182.134.169:56368 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:162629 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:57971 Archived-At: Thierry Volpiatto writes: > Nordlöw 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")) > | ("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! > 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. -- __Pascal_Bourguignon__