From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: lisp question Date: Sun, 29 Apr 2007 13:32:15 -0400 Organization: Symantec Message-ID: References: <871wi385na.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1177868122 29857 80.91.229.12 (29 Apr 2007 17:35:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 29 Apr 2007 17:35:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 29 19:35:21 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 1HiDIu-0006Xi-6X for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Apr 2007 19:35:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HiDOz-0002aZ-Pr for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Apr 2007 13:41:37 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Sun, 29 Apr 2007 12:32:15 -0500 Original-Newsgroups: gnu.emacs.help Mail-Copies-To: nobody User-Agent: MT-NewsWatcher/3.5.2 (PPC Mac OS X) X-Copies-To: never Original-Lines: 55 Original-NNTP-Posting-Host: 24.34.108.171 Original-X-Trace: sv3-9tK9ivW1EXi4ZfGRhgGcFAZYK1hOJOhcdhOld14DKWk50hzcxdFmURboCDzAXnIdZoxlioSdRKsdLrf!jOGC9L3TnMBqRzFcEXoyAZaFDCZX7SqSDm/vpLsvTq0ddH6bm4taMmRviKobELsp7OfZlb6iitIT!jUeIIgeFrM7cJzDH7TZqEiCHcHmOgvbAu7dxxW53qA== Original-X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Original-Xref: shelby.stanford.edu gnu.emacs.help:147752 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:43355 Archived-At: In article <871wi385na.fsf@gmail.com>, Hadron wrote: > from the lisp tutorial which comes with emacs 22: > > ,---- > | 1.8.3 Variable Number of Arguments > | ---------------------------------- > | > | Some functions, such as `concat', `+' or `*', take any number of > | arguments. (The `*' is the symbol for multiplication.) This can be > | seen by evaluating each of the following expressions in the usual way. > | What you will see in the echo area is printed in this text after `=>', > | which you may read as `evaluates to'. > | > | In the first set, the functions have no arguments: > | > | (+) => 0 > | > | (*) => 1 > | > | In this set, the functions have one argument each: > | > | (+ 3) => 3 > | > | (* 3) => 3 > | > | In this set, the functions have three arguments each: > | > | (+ 3 4 5) => 12 > | > | (* 3 4 5) => 60 > `---- > > It kind of glosses over sections (1) and (2). > > Why do (*) and (* 3) evaluate to 1? (* 3) evaluates to 3, not 1. With associative functions, calling them with no arguments returns the identity value for that function. This maintains the equivalence that ( ) == ( ( ) ( )) for any partitioning of the original arguments, including part1 or part2 being empty. E.g. (* 3 4 5) = (* (* 3) (* 4 5)) = (* (*) (* 3 4 5)) -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***