From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: `append' vs. `nconc' Date: Thu, 31 Dec 2015 22:04:08 +0200 Message-ID: <87wprucrlz.fsf@mithlond.arda> References: <568164D8.6050700@ojkastl.de> <87io3iyr7t.fsf@debian.uxu> <87si2kezg1.fsf@mithlond.arda> <87a8osrlj4.fsf_-_@debian.uxu> <87lh8bgafa.fsf@mithlond.arda> <87io3fdqfm.fsf@mithlond.arda> <87mvsqv52v.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1451592286 23034 80.91.229.3 (31 Dec 2015 20:04:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2015 20:04:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 31 21:04:39 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aEjSg-00075R-BU for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2015 21:04:38 +0100 Original-Received: from localhost ([::1]:56684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEjSf-0004AJ-Nf for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2015 15:04:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEjST-00049z-1S for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 15:04:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEjSP-0003aK-S6 for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 15:04:24 -0500 Original-Received: from mta-out1.inet.fi ([62.71.2.193]:45593 helo=johanna2.inet.fi) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEjSP-0003Zo-HF for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 15:04:21 -0500 RazorGate-KAS: Status: not_detected RazorGate-KAS: Rate: 0 RazorGate-KAS: Envelope from: RazorGate-KAS: Version: 5.5.3 RazorGate-KAS: LuaCore: 80 2014-11-10_18-01-23 260f8afb9361da3c7edfd3a8e3a4ca908191ad29 RazorGate-KAS: Lua profiles 69136 [Nov 12 2014] RazorGate-KAS: Method: none Original-Received: from mithlond.arda (84.251.143.106) by johanna2.inet.fi (9.0.002.03-2-gbe5d057) id 56701413017F0006 for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 22:04:13 +0200 Original-Received: from dtw by mithlond.arda with local (Exim 4.84) (envelope-from ) id 1aEjSG-0003mD-Hd for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 22:04:12 +0200 In-Reply-To: <87mvsqv52v.fsf@debian.uxu> (Emanuel Berg's message of "Thu, 31 Dec 2015 19:35:52 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 62.71.2.193 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108560 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Emanuel Berg [2015-12-31 19:35:52+01] wrote: > Teemu Likonen writes: >> (setq foo (nconc (list '(a . 1) '(b . 2)) foo)) > What is the reason one has to use `list'? (I suppose the ` isn't safe, > either.) LIST function creates a fresh list when it is evaluated, usually at runtime. The following applies to the Common Lisp language: Literal objects created with ' ` (QUOTE ...) "string" etc. might be created at compile time. Such objects might even be shared by all instances of such literal object. Common Lisp compilers are allowed to do that. So, the literal list '(a b c) in one place might actually become the very same (as in EQ) object as literal '(a b c) in somewhere else. If you mutate one object the results may show everywhere, which is not usually wanted. Even though it may not apply to Emacs Lisp or all Common Lisp compilers it's good habit to not mutate literally created objects. Be functional with them! :-) =2D-=20 /// Teemu Likonen - .-.. // // PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 /// --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWhYo8AAoJEHGdadMkU5RQz+QQAME2jcmerbl7R2ShuGuBxRzq 5DxQ8F6MlOsN+ByOFWOJ1CM4ffzg+k6yqBo3uFCcIznxcDF0MMU8sDsC6VYjJoh1 HXMDm8Quk7W9NLlqLnJZyQxbkQ485yE1489WXsjSjBb2nPfxepTAW8OXtLRonlqn 05FY4d7nDfQyRjzcvFSaCB4ih3X7Zxc/DaWGhIdWGnaJRTAgM1vk/VZdOehh+6Dh 3z4O0HPFpISC/JbKtrWigi03lP59XhIl/dout9rTLQZOeMmydNBONAudWdtqeC26 ua/ZT5cJxBHDoZogScOVhI6Pg7pbB7rqRaZlXSRcdXtS+pzXNFMf7ACuDqNLdFGi aLJyGvPRQRHMhfQCCZQKqddgqaVVAch8QCi/vjxw/wKGZASNYyUqWtLbC8lxQW2T umABJt5qekNHJ4rM1mzIvFQ2jWwAw3QasheVAto851/4fJT15KTScQermomhVj3u HgO2FAgknElw3VkjTW6iMVDf//RNDqUrk63zyzD7Btq27mHzunKzpTro3NwOpD4f sWcfUikHbYJilqdRcLdBm0fs6csbmYsS/OAZVZk2DTdKFW7FBwoO6wRk8IE/9y0X uHbY3g2CvMUhvNfgmas84G77xur+vMa6qROcOfpHLDOBWIQ62v1wIhGVBis7N7YU Kvk14pRHfL3Tpf5WMJ50 =CpM5 -----END PGP SIGNATURE----- --=-=-=--