[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (*) -> 1
From: |
Óscar Fuentes |
Subject: |
Re: (*) -> 1 |
Date: |
Wed, 18 Jan 2023 14:57:01 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Jean Louis <bugs@gnu.support> writes:
> * Michael Heerdegen <michael_heerdegen@web.de> [2023-01-17 22:20]:
>> The question of use is a valid one, we missed to answer it yet. It
>> wasn't clear to me that this was part of what you are asking for.
>
> Yes, that one.
>
> Why authors decided to have (*) ➜ 1 which in case of me who could
> delete some argument like from (* tonnes quantity) I could by mistake
> delete "tonnes and quantity" and result of (*) would not be detected
> because there is no error
Throwing an error on this case is a reasonable possibility for the
language designers, but instead they decided to extend * to zero and one
arguments. Why? because it is convenient, because it makes possible to
do things like (apply '* some-list) without caring about how many
elements some-list has, which is handy when some-list comes from a place
you don't control. As far as the extension of * is reasonable, it is
nice to have, that's what the language designers thought.
So what's the reasonable extension of * (the variadic function!) to zero
arguments? Let's use some basic algebra:
(apply '* (list a b)) == (apply '* (list 1 1 a b))
which is the same as:
a * b == 1 * 1 * a * b
remove b:
a == 1 * 1 * a
remove a:
? == 1 * 1
which the same as:
(apply '* ()) == (apply '* (1 1))
or
(*) == (* 1 1)
So * applied to zero arguments shall be 1, because any other value would
break the equality.
- Re: (*) -> 1, (continued)
- Re: (*) -> 1, Jean Louis, 2023/01/17
- Re: (*) -> 1, Eduardo Ochs, 2023/01/17
- Re: (*) -> 1, Michael Heerdegen, 2023/01/17
- Re: (*) -> 1, Jean Louis, 2023/01/18
- Re: (*) -> 1, Michael Heerdegen, 2023/01/18
- Re: (*) -> 1, Jean Louis, 2023/01/19
- Re: (*) -> 1, Tassilo Horn, 2023/01/19
- Re: (*) -> 1, Michael Heerdegen, 2023/01/19
- Re: (*) -> 1, Jean Louis, 2023/01/19
- Re: (*) -> 1, tomas, 2023/01/19
- Re: (*) -> 1,
Óscar Fuentes <=
- Re: (*) -> 1, Jean Louis, 2023/01/19
- Re: (*) -> 1, Óscar Fuentes, 2023/01/19
- Re: (*) -> 1, Jean Louis, 2023/01/20
- Re: (*) -> 1, Michael Heerdegen, 2023/01/18
- Re: (*) -> 1, Jean Louis, 2023/01/19
- Re: (*) -> 1, Michael Heerdegen, 2023/01/19
- Re: (*) -> 1, Jean Louis, 2023/01/19
- Re: (*) -> 1, Tassilo Horn, 2023/01/19
- Re: (*) -> 1, Michael Heerdegen, 2023/01/19
- Re: (*) -> 1, Dr Rainer Woitok, 2023/01/19