help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (*)->1


From: Michael Heerdegen
Subject: Re: (*)->1
Date: Sat, 14 Jan 2023 13:03:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Jean Louis <bugs@gnu.support> writes:

> Thus (+) ➜ 0 without value result should not be zero. If no values
> where given to addition, no addition has taken place. Value of zero
> should not get out of nothing.

Mathematically it is neither right nor wrong.  It is a convention to
assign 0 to an empty sum.  This is for convenience, and it doesn't lead
to contradictions.

It is convenient because if you decompose a sum into partial sums,
equations remain correct for the corner case of empty partial sums: then
the contribution of an empty partial sum to the whole sum is 0.
Likewise for products and other operations.  This convention is used in
whole mathematics because it elegantly avoids case distinctions.

It's also a useful convention in programming.  For example, the initial
value of an accumulator of a sum calculation is 0.

If you sum up partial sums it would be nonsense to assign a special
value for empty partial sums that behaves like 0 but means

  0_{from zero summands}.

We also don't have

  7_{from 3 summands}

we just have 7.  The number of summands doesn't matter if you are
interested in a sum, even when the number of summands is zero.  Note
that nobody will ever use the expression (+) directly to find 0 to try
to learn something from it.  But the case may appear in calculations
like e.g. (apply #'+ args) and such where an empty arg list might appear.

Some other perspective: when you play a video game and got no rewarded
actions before game over, your score is typically 0.  You could also get
"void game" or no entry in the high score list.  As I said, it's a
mathematical convention, you can't derive something wrong from it, it's
just convenient.  We could make (+) error or emit something new but that
would just make Elisp worse.


Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]