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

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

Re: (*) -> 1


From: Óscar Fuentes
Subject: Re: (*) -> 1
Date: Thu, 19 Jan 2023 17:51:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Jean Louis <bugs@gnu.support> writes:

> * Óscar Fuentes <ofv@wanadoo.es> [2023-01-18 16:58]:
>> 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. 
>
> That explanation sounds like neglect in programming.

That's your personal opinion. Quite a few programmers think that not
using strict strongly-typed, statically-typed languages is
irresponsible, and see, here we are dicussing Lisp.

BTW, do you consider support for more than two arguments on + and * also
a neglect in programming?

> I have mentioned
> that PicoLisp can `apply' with (*) yielding NIL. Try it out.

The first thing written in PicoLisp's home page is:

   PicoLisp is quite different from other Lisps.

So be wary when taking PicoLisp's behavior as a comparison point when
discussing other Lisp implementations.

> ~$ pil
> : (*)
> -> NIL
> : (+)
> -> NIL
> : (apply '* '(2 3))
> -> 6

What's the output of

(apply '* '())

in PicoLisp?

> it means it is not really to give relief to other functions. And there
> is nothing wrong for apply to yell the error when arguments are
> missing to the function.
>
> If you have some reference to that reasoning that (*) is related to
> `apply' from language designer, let me know.

I have no such references, nor I need them: it is immediately obvious to
me.

BTW, I'll say this for the last time:

In Elisp, + is not the binary addition operator. It is the summation
operator (aka Σ) for finite sequences.

In Elisp, * is not the binary multiplication operator. It is the product
operator (aka Π) for finite sequences.

Once you internalize this, things will be clearer.




reply via email to

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