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

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

Re: [External] : Re: How to make M-x TAB not work on (interactive) decla


From: Jean Louis
Subject: Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?
Date: Tue, 17 Jan 2023 08:35:03 +0300
User-agent: Mutt/2.2.9+54 (af2080d) (2022-11-21)

* Drew Adams <drew.adams@oracle.com> [2023-01-17 05:21]:
> > > The use of `apply', pointed out by Anders, speaks
> > > directly to "any number of arguments".  It applies
> > > a function (e.g. `+') to "any number of arguments",
> > > which are passed as a list.
> > 
> > Any number means also no argument? To me that is not clear.
> 
> That's why I pointed out that _zero is a number_.

That is clear.

> A zero number of args means zero args, which
> means no args.

Aha that is what you mean. Sounds like practical joke with function
descriptions. Though that is not what is expressed like:

* is a built-in function in ‘C source code’.

(* &rest NUMBERS-OR-MARKERS)

Return product of any number of arguments, which are numbers or
markers.

Product of any number of arguments when there are no arguments can't
be 1 -- so function description is logically justified with your
statement, but not consistent, I can't be sure if author intended it
that way how you justify it, due to inconsistency.

> > Any number of arguments is to me that it must be at least one
> > argument, not no argument.
> 
> Zero is a number.  I have zero Ferraris. :-(

Multiply your Ferraris and tell me if you get one in the garage.

> > * is a built-in function in ‘C source code’.
> > (* &rest NUMBERS-OR-MARKERS)
> > Return product of any number of arguments, which are numbers or markers.
> > 
> > But without having arguments, the product is one,
> > which contradicts multiplication how I know it.
> 
> Yes, it's taking a shortcut, supposing that you
> think of a "product" of one arg and a "product"
> of zero args: (* N) -> N, (*) -> 0

Not zero but: (*) ➜ 1 -- we are back to Ferrari.

I don't get it.

> Imagine that you wanted to define a "product" function that works
> with any number of args.  What would _you_ define as its behavior
> (return value) for the zero-args case?  And what would you use for
> the single-arg case?

I expect (*) to tell me that it is error, that arguments are
missing. I learned multiplication in school, we never had impossible
situation of using single argument. As number has to be multiplied by
number. Multiplication table has always 2 arguments.

The manual says like:

 > -- Function: + &rest numbers-or-markers
 >     This function adds its arguments together.  When given no
 >     arguments, ‘+’ returns 0.
1
but I wonder why is that explained in manual and not in docstring.

For now I can only think that it deviates from common multiplication
that requires 2 numbers for the reason to be used in Lisp functions
such as `apply' or others, just that I can't yet confirm it if that is
designed for that particular reason.

(apply '* nil) ➜ 1

-- 
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]