From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: symbols and cells Date: Thu, 15 May 2014 22:16:06 +0200 Message-ID: <87ppje23y1.fsf@web.de> References: <20140515091005.52cc1897@voltron.arsc.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1400185018 22835 80.91.229.3 (15 May 2014 20:16:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 May 2014 20:16:58 +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 May 15 22:16:51 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 1Wl25B-0003M8-0u for geh-help-gnu-emacs@m.gmane.org; Thu, 15 May 2014 22:16:49 +0200 Original-Received: from localhost ([::1]:60341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wl25A-0002CK-Jn for geh-help-gnu-emacs@m.gmane.org; Thu, 15 May 2014 16:16:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wl24t-0002CB-8P for help-gnu-emacs@gnu.org; Thu, 15 May 2014 16:16:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wl24o-00069H-GX for help-gnu-emacs@gnu.org; Thu, 15 May 2014 16:16:31 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:36056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wl24o-00068w-Ay for help-gnu-emacs@gnu.org; Thu, 15 May 2014 16:16:26 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Wl24j-00028i-As for help-gnu-emacs@gnu.org; Thu, 15 May 2014 22:16:21 +0200 Original-Received: from ip-90-187-75-147.web.vodafone.de ([90.187.75.147]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 15 May 2014 22:16:21 +0200 Original-Received: from michael_heerdegen by ip-90-187-75-147.web.vodafone.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 15 May 2014 22:16:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 41 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip-90-187-75-147.web.vodafone.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.90 (gnu/linux) Cancel-Lock: sha1:v8ruQtTGB7kh4J9DPFGxKWlMw78= 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:97685 Archived-At: Christopher Howard writes: > I'm still working through the earlier parts of the Elisp > documentation, but I am curious: How does one define the variable cell > and function cell for an /uninterned/ symbol? The docs indicate you > can do this: > > (defvar sym (make-symbol "foo")) > > But how do you add a function or variable value to foo without > interning it? "Interning it" is a bit imprecise, since an uninterned symbol can't be interned, only the string "foo" could be interned, and the result would be different from any uninterned symbol of the same name. You can use the functions `set' to set the value cell and `fset' to set the function cell. An even better question is: how would you call this uninterned symbol as a function...? Using uninterned symbols is almost only useful when macros are involved. You should not care too much about them until you use macros. > On a related note, I'm curious about this perverse construction: > > (defvar sym1 (lambda (n) (+ 1 n))) > > Is it actually possible to call the the lambda somehow? Of course - with `funcall'. And it's not perverse at all in Lisp where functions are first class objects. That Elisp is Lisp 2 (symbols have separate value and function cells) doesn't mean that you can't bind a variable to a function (i.e., set the value cell of a symbol to a function). On the contrary, this is quite normal. Michael.