From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: hash strangeness Date: Tue, 04 Nov 2014 08:39:40 +0100 Message-ID: <87ioive7nn.fsf@wmi.amu.edu.pl> References: < < <0041d5f2-b328-4017-a748-ead21589f05e@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415086817 9723 80.91.229.3 (4 Nov 2014 07:40:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Nov 2014 07:40:17 +0000 (UTC) To: Barry Margolin , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 04 08:40:13 2014 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 1XlYiq-0007bK-Ev for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2014 08:40:12 +0100 Original-Received: from localhost ([::1]:38989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlYiq-0002gc-4v for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2014 02:40:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlYic-0002g9-Nw for help-gnu-emacs@gnu.org; Tue, 04 Nov 2014 02:40:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlYiY-0004kK-3G for help-gnu-emacs@gnu.org; Tue, 04 Nov 2014 02:39:58 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:46940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlYiX-0004jx-Ss for help-gnu-emacs@gnu.org; Tue, 04 Nov 2014 02:39:54 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 26D8442279; Tue, 4 Nov 2014 08:39:51 +0100 (CET) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O8qtyf9tJQ9L; Tue, 4 Nov 2014 08:39:51 +0100 (CET) Original-Received: from localhost (99-229.echostar.pl [213.156.99.229]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id DA8CD42257; Tue, 4 Nov 2014 08:39:50 +0100 (CET) In-reply-to: <0041d5f2-b328-4017-a748-ead21589f05e@default> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 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:100726 Archived-At: On 2014-11-04, at 04:04, Drew Adams wrote: >> > I expect '(a b c) to create a new list with these symbols >> > every time it runs. >> >> Why do you expect that? >> '(a b c) is short for (quote (a b c)). quote returns its argument, it >> doesn't make a copy of it. >> >> I'm sure somewhere in the Elisp programming manual it mentions that you >> shouldn't use destructive functions on literal lists, like the Common >> Lisp spec does. > > Here is one place: the Elisp manual, node `Rearrangement`. Search for > "a common pitfall". > > https://www.gnu.org/software/emacs/manual/html_node/elisp/Rearrangement.html And to see it yourself, execute (e.g. with C-x C-e) the following in order: (defun myfun () (setq myvar '(a b c))) (myfun) (symbol-value 'myvar) (symbol-function 'myfun) (nconc myvar '(1 2 3)) (symbol-value 'myvar) (symbol-function 'myfun) Hth, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University