From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: About `defun' in elisp manual Date: Fri, 28 Dec 2012 07:35:37 -0800 Message-ID: <243EA2B5CB98436D8D85D475B7F28358@us.oracle.com> References: <87r4mav3iw.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1356708959 15290 80.91.229.3 (28 Dec 2012 15:35:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Dec 2012 15:35:59 +0000 (UTC) To: "'Pascal J. Bourguignon'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 28 16:36:15 2012 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 1Tobyo-0002sG-EH for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Dec 2012 16:36:14 +0100 Original-Received: from localhost ([::1]:53794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TobyZ-0002XG-Rc for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Dec 2012 10:35:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TobyN-0002X6-TV for help-gnu-emacs@gnu.org; Fri, 28 Dec 2012 10:35:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TobyM-0008EK-5c for help-gnu-emacs@gnu.org; Fri, 28 Dec 2012 10:35:47 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:47875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TobyL-0008EA-Rx for help-gnu-emacs@gnu.org; Fri, 28 Dec 2012 10:35:46 -0500 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qBSFZh33026756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Dec 2012 15:35:44 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qBSFZgG0012896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Dec 2012 15:35:42 GMT Original-Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qBSFZf05021644; Fri, 28 Dec 2012 09:35:42 -0600 Original-Received: from dradamslap1 (/10.159.169.98) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 28 Dec 2012 07:35:40 -0800 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ac3k6+ju6vUBueDRRvGhUsd1sTkGBwAHwN7Q X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 In-reply-to: <87r4mav3iw.fsf@kuiper.lan.informatimago.com> X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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:88334 Archived-At: > Above, BODY-FORM must be a proper list therefore the lambda expression > is a proper list. While correct and providing the info needed for understanding, I'm not sure that the explanation given so far will directly bridge Fuqiao's misunderstanding. The first thing is the typo: it is BODY-FORMS, not BODY-FORM, and that is an important clue. The point is that a lambda expression does not *require one* sexp (a list or an atom) after ARGUMENT-LIST - it accepts any number of sexps, including zero. BODY-FORMS is a list here - a list of body forms, which themselves are often lists. If a lambda expression accepted only one list as its body then removing the dot for the syntax would be correct. BODY-FORMS has zero or more elements. By using the dot, the syntax indicates that the list is *spliced into* the lambda expression, instead of simply appearing as a single list sexp. IOW, each of its elements is a body form, and they are what appear directly in the lambda expression. If BODY-FORMS is ((foo bar)) then there is a single body form, (foo bar), and the sexp is (lambda ARGUMENT-LIST (foo bar)). If BODY-FORMS is (foo bar) then there are two body forms, foo and bar, and the sexp is (lambda ARGUMENT-LIST foo bar). Now go back and read what Pascal and Florian wrote, explaining that lists are really dotted lists. As Pascal said, BODY-FORMS is a *proper* list, that is, a dotted list with () as its final cdr. If BODY-FORMS is (X Y Z) then (A . BODY-FORM) is (A X Y Z), that is, (A . (X . (Y . (Z . nil)))) [Be aware that sometimes the Emacs doc writes "BODY-FORMS..." instead of ". BODY-FORMS". And it might not be clear to some readers whether that means one or more or zero or more sexps. In most contexts other than Emacs, "A..." stands for a single A followed possibly by additional As: one or more repetitions of A. But in Emacs doc the "..." seems to stand for zero or more, not one or more, and the Emacs doc writes "BODY-FORMS..." (plural and with repetitions), not "BODY-FORM...". Sometimes it writes "BODY..." (singular) and then in the text refers to BODY in the plural: "forms". (Also, sometimes there is a space before "...", sometimes not.) The syntax used in the description of a lambda expression is simpler and has no such ambiguity and sending of mixed signals - it is Lisp syntax!]