From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: `append' vs. `nconc' Date: Thu, 31 Dec 2015 05:00:07 +0100 Message-ID: <87wprvqnco.fsf@debian.uxu> References: <568164D8.6050700@ojkastl.de> <87io3iyr7t.fsf@debian.uxu> <87si2kezg1.fsf@mithlond.arda> <87a8osrlj4.fsf_-_@debian.uxu> <87lh8bgafa.fsf@mithlond.arda> <877fjve0x5.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451534440 6913 80.91.229.3 (31 Dec 2015 04:00:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2015 04:00:40 +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 05:00:31 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 1aEUPe-0000aM-GG for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2015 05:00:30 +0100 Original-Received: from localhost ([::1]:54581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEUPd-0006mT-Kl for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Dec 2015 23:00:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEUPS-0006mJ-OZ for help-gnu-emacs@gnu.org; Wed, 30 Dec 2015 23:00:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEUPP-00020X-EK for help-gnu-emacs@gnu.org; Wed, 30 Dec 2015 23:00:18 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:50398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEUPP-000208-7A for help-gnu-emacs@gnu.org; Wed, 30 Dec 2015 23:00:15 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aEUPN-0000Pz-AH for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 05:00:13 +0100 Original-Received: from nl106-137-56.student.uu.se ([130.243.137.56]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Dec 2015 05:00:13 +0100 Original-Received: from embe8573 by nl106-137-56.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Dec 2015 05:00:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 41 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-56.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:aOsNBQsfQgoCpIS9cOou/iH07XM= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:108543 Archived-At: "Pascal J. Bourguignon" writes: >> OK, so for example this: (setq >> completion-ignored-extensions (append >> completion-ignored-extensions '(".bcf" ".run.xml")) >> ) Is better as: (nconc completion-ignored-extensions >> (list ".bcf" ".run.xml")) ? > > No. You should never use nconc only for effect (just > like delete, etc). What do you mean by "effect"? The reason I thought it fitting was the definitions of `append' and `ncons'. Here I want to change `completion-ignored-extensions'. `append' doesn't change it, which is why the assignment with `setq' was there. If it can't be removed (well, in the form of `setf'), there is still the gain of not creating the list unnecessarily, which in this case is a matter of principle but in other cases (with long lists) is a performance bottleneck? > Always re-assign the modified list: > > (setf completion-ignored-extensions (nconc > completion-ignored-extensions (list ".bcf" > ".run.xml"))) > > otherwise it will break when the place is bound to > nil. (nil is a symbol and cannot be mutated into > a cons cell!). ? What place is bound to nil, when? -- underground experts united http://user.it.uu.se/~embe8573