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

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

Re: (*) -> 1


From: Jean Louis
Subject: Re: (*) -> 1
Date: Tue, 17 Jan 2023 21:40:14 +0300
User-agent: Mutt/2.2.9+54 (af2080d) (2022-11-21)

* Óscar Fuentes <ofv@wanadoo.es> [2023-01-17 21:13]:
> This is not about Mathematics, it is about notation, that means,
> convention, that means, convenience.
> 
> In other programming languages an expression such as "+ 2" would yield a
> partially applied function:
> 
> let f = + 2
> f 5
> -> 7
> 
> Lisp (or some implementations of it) went the route of "+ sums a list of
> numbers." That's fine, and in that sense having (+) -> 1 is reasonable,
> but there is nothing in Mathematics that says that it must be so instead
> of yielding partially applied function, or simply throwing an error
> message. Lisp's option is a consequence of its syntax (notation).

Okay, but in C language definition of function `+' I see that if no
arguments are supplied the result shall be 0, or for `*' the result
shall be 1. So I see it from authoring side being something of
importance, not from syntax side, as author, programmer, maybe
Stallman, he could as well hande those functions with error, there was
some reason why they deliberately explicitly decided to provide
identity in absence of any arguments.

At least I feel closer to solution after looking at "variadic
functions".

In the sense of minimizing errors, I have no example, is hard to
understand that is the reason. In fact I need errors with many
functions, as they are useful.

I would not like really in my mathematical functions to get result 1
if I for example forgot to write something, instead of writing:

(setq hours 10) ➜ 10
(setq interval 2) ➜ 2
(setq waiting-time 2) ➜ 2
(setq my-appointment (+ hours (* interval waiting-time))) ➜ 14
so if I write by mistake following:
(setq my-appointment (+ hours (*))) ➜ 11

I would not like that mistake being there, as that would by my typo,
and I need error, and not silent ignorance that I missed to write some
arguments. 

I have given one example why and how I understand that function `*'
would be more useful to yield the erorr, then 1.

What I am searching is why is (*) function useful to yield 1 in some
example. Do you have it? Can you maybe think of one?

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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