From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: comparing symbols coming from gensym? Date: Wed, 24 Aug 2005 08:24:52 +0000 Organization: muc.de e.V. -- private internet access Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1124883670 32216 80.91.229.2 (24 Aug 2005 11:41:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 Aug 2005 11:41:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 24 13:41:09 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E7tb6-0003JG-KY for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Aug 2005 13:39:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E7tev-00027O-4E for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Aug 2005 07:43:09 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news-lei1.dfn.de!news-stu1.dfn.de!news.belwue.de!informatik.tu-muenchen.de!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1124879767 35954 193.149.49.134 (24 Aug 2005 10:36:07 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 24 Aug 2005 10:36:07 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:133422 Original-To: help-gnu-emacs@gnu.org 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:28953 Archived-At: Joe Corneli wrote on Tue, 23 Aug 2005 23:50:46 -0500: > Why is it that > (setq a (gensym)) ;=> G2007 > a ;=> G2007 > (equal a 'G2007) ;=> nil > while > (setq a 'foo) ;=> foo > a ;=> foo > (equal a 'foo) ;=> t > ? This is because your gensymmed symbol, 'G2007, has only been "half-created". It hasn't been "interned" in the "obarray", the structure which holds (almost) all symbols - that 'G2007 is a free-floating symbol. When you do (equal a 'G2007), this _creates_ a full-bloodied industrial-strength NEW _interned_ symbol G2007, since there wasn't already such a symbol in the obarray. This is distinct from your gensymmed one. That is, in fact, the whole point of gensym - to create a symbol distinct from any other symbol which ever has been or ever will be. You asked for it, you got it! If you want to actually _use_ it, you'll need something like (symbol-value a) Look up `gensym' in the CL manual, and `intern' in the Elisp manual. -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").