From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pascal Costanza Newsgroups: gmane.emacs.help Subject: Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why? Date: Mon, 08 Oct 2007 08:39:16 +0200 Message-ID: <5mu1klFevrusU1@mid.individual.net> References: <1191735269.656673.146370@50g2000hsm.googlegroups.com> <5mrsliFesppjU1@mid.individual.net> <1191799640.394781.254540@v3g2000hsg.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1191825671 8125 80.91.229.12 (8 Oct 2007 06:41:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 Oct 2007 06:41:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 08 08:41:08 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IemIe-0007RS-Ax for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Oct 2007 08:41:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IemIZ-0007gU-CK for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Oct 2007 02:41:03 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: comp.lang.lisp,gnu.emacs.help,comp.lang.scheme Original-Lines: 52 Original-X-Trace: individual.net JH1MBP/8mnD7yLR8azVBHwRKslKLTrR83uZ2DWrPr9mYuYWgYK Cancel-Lock: sha1:e1OV6MOWUDXb7pPoB7NjIby61Eg= User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) In-Reply-To: <1191799640.394781.254540@v3g2000hsg.googlegroups.com> Original-Xref: shelby.stanford.edu comp.lang.lisp:230607 gnu.emacs.help:152699 comp.lang.scheme:74329 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:48207 Archived-At: David Rush wrote: > On Oct 7, 12:02 pm, Pascal Costanza wrote: >> Common Lisp (and presumably Emacs Lisp) is a Lisp-2, which means that >> function positions are evaluated differently than value positions. > > Now I may be demonstrating a certain amount of historical ignorance > here, but I was under the impression that Lisp-2 referred to the fact > that there were effectively to different *name* spaces, one in which > 'ordinary' values were bound and one in which 'callable' values were > bound. This is correct. However, the namespace for ordinary values may also contain callable values, whereas the namespace for callable values may contain callable values only. > However, this text: > >> order to treat a first-class value as a function, you have to shift it >> via FUNCALL. In order to yield a function as a first-class value, you >> have look it up with FUNCTION. > > Makes it sound like there are two fundamentally different *types* of > values And FUNCALL and FUNCTION are the type cast operators between > those types. Is this a valid way of looking at this? No, and I am sorry if I have given that impression. Still, the function namespace may contain only callable values, and in that regard that namespace is indeed typed. This is why this may be confusing. But it is in fact much simpler: (let ((foo 42)) (flet ((foo (x) (print x))) (foo foo))) This code binds 42 to foo in the value namespace, and a function to foo in the function namespace. The first position in the expression (foo foo) looks up the latter, the second position looks up the former. Overall, the whole expression prints 42. This is all there is to this: The first position is looked up in a different namespace than all the other positions. Pascal -- My website: http://p-cos.net Common Lisp Document Repository: http://cdr.eurolisp.org Closer to MOP & ContextL: http://common-lisp.net/project/closer/