From: Hadron <hadronquark@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: lisp question
Date: Mon, 30 Apr 2007 01:06:04 +0200 [thread overview]
Message-ID: <87bqh6eq77.fsf@gmail.com> (raw)
In-Reply-To: barmar-0A948B.13321529042007@comcast.dca.giganews.com
Barry Margolin <barmar@alum.mit.edu> writes:
> In article <871wi385na.fsf@gmail.com>, Hadron <hadronquark@gmail.com>
> 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.
Sorry, yes.
>
> With associative functions, calling them with no arguments returns the
> identity value for that function. This maintains the equivalence that
>
> (<fun> <arguments>) == (<fun> (<fun> <part1>) (<fun> <part2>))
>
> for any partitioning of the original arguments, including part1 or part2
> being empty. E.g.
>
> (* 3 4 5) = (* (* 3) (* 4 5)) = (* (*) (* 3 4 5))
All clear. Thanks.
next prev parent reply other threads:[~2007-04-29 23:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-29 17:14 lisp question Hadron
2007-04-29 17:32 ` Barry Margolin
2007-04-29 23:06 ` Hadron [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-04-30 18:25 A Soare
2007-04-30 19:09 ` Peter Dyballa
[not found] <mailman.5.1177957929.32220.help-gnu-emacs@gnu.org>
2007-05-01 8:23 ` Brendan Halpin
2007-05-01 11:41 ` Hartmut Figge
2007-05-01 13:24 ` Malte Spiess
2007-05-01 18:39 A Soare
2007-05-01 19:10 ` Jesper Harder
2007-05-01 21:11 ` Marco Almeida
[not found] <mailman.55.1178045196.32220.help-gnu-emacs@gnu.org>
2007-05-01 19:21 ` Maarten Bergvelt
2007-05-01 20:32 ` Scott Frazer
2011-08-04 2:25 suvayu ali
2011-08-04 4:52 ` Jambunathan K
2011-08-04 6:49 ` suvayu ali
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bqh6eq77.fsf@gmail.com \
--to=hadronquark@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.