unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: (*) -> 1
Date: Wed, 18 Jan 2023 15:27:55 +0300	[thread overview]
Message-ID: <Y8fly8k72s+iVJYF@protected.localdomain> (raw)
In-Reply-To: <87zgahj7h3.fsf@web.de>

* 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 -- while makers (authors) of which Lisp, as
I do not know where did it start, maybe in Common Lisp, maybe in Emacs
Lisp, why did they decide to include it?

So let me read here:

> You list your expenses in a form.  On six pages.  You write the sum of
> all expenses of any page on the bottom of the page to be able to
> calculate the final sum conveniently.
> 
> But on page 5 there are no expenses at all.  What do you write on the
> bottom of that page?  You could write nothing, but then you might wonder
> if you have forgotten to fill out that page.  You could also leave a
> special note "no expenses" - but in Lisp we don't have such special
> values that can be used in summation.  So you just write "0" onto that
> page - the partial sum of no summands.  That works because adding 0
> doesn't change the final result (as adding zero summands to the final
> sum would) - it's the same in the case of summation: 0 is the "nothing"
> of addition.

Writing zero is one thing, surely I understand above. I said that I
did read the identity element article, and that articles does not
speak of absence of elements! It speaks that identity element is the
one when added to other elements, it does not change the result.

We have here case of absence of elements, not presence of
elements.

I understand your practical example above, I can't see relation to
Lisp where author made (*) to result with 1. Of course I understand
that some people say ah, there is set theory and that is identity
element, but practical use in multiplication or addition I still can't
find.

I got clue that having that identity element was maybe helpful in
other programming language like C, and then somebody started placing
it in Lisp arithmetic functions, where maybe it does not have any real
use. I may be wrong, but research of variadic functions kind of gives
me clue to that conclusion.

> Likewise, 1 is the "nothing" of products and "" is the "nothing" of
> string `concat'enation, etc.

I can't see that 1 is nothing for produts, but I understand what you
wish to say. 

If (*) ➜ 1 is "nothing", adding three "nothing" yields with 3:

(+ (*) (*) (*)) ➜ 3

which can't be, as nothing added to nothing can't give more than
nothing. However, I do understand what you wanted to say, just with
different terms.

> This interpretation only makes sense when the result of (+), (*),
> (concat) appears as intermediate result in some other call of `+',
> `*', `concat'.  By themselves the value is not always meaningful (0
> as the value of the empty sum might be meaningful, 1 as result of an
> empty product less, the empty string as results of concatenating no
> strings -- depends).  But it allows to avoid to treat the case of
> empty subsets specially.

I understand in Lisp context that various functions shall give me back
result, to help me with programming. But I do not see why would
(concat) ➜ "" not result with errors, I would like error there to be
reminded that I forgot something.

Maybe before programmer wish to write which strings are to be
concatenated, one can use function temporarily for testing, like

(let ((result (ignore))
       (my (concat))))
  my)

and then later this function becomes something like:

(let ((result (fetch-results))
       (my (concat "Result is: " result))))
  my)

For (concat) I can see use case as placeholder for string, so that
programmer can update the function.

Otherwise I don't know. Do you know use case for (concat)?

Some string functions I made I want them to give me empty string
instead of nil, but for concat I don't know why I would want that, I
want error.

For (*) I have not find use. Maybe use is in that temporary
programming moments, where programmer wish to add some numbers, but
did not add them yet, like following:

1. Programmer thinks of variables A multiplied by B 
    to be multiplied with C mutliplied by D

2. But writes without variables C and D: (* (* A B) (*))

3. Then in next step adds C and D: (* (* A B) (* C D))

Was that use case or something else that justified creation of (*) ➜ 1

Or was it just capricious thinking: "Let me add identity element, it
will look more like advanced mathematics"

Or was it the reason that it was maybe copied from C language which I
do not know, and which maybe got much more use of functions which
yield 1 for multiplication without any elements?

> > OK I understand people in Common Lisp included it, and Emacs Lisp has
> > it, and other Lisps. But why for example Emacs Lisp has (-) ➜ 0 but
> > other Lisps not?
> 
> That's also a valid question.
> 
> (-) and (/) are questionable.  `-' accepts one argument, so e.g. (- 7)
> ==> 7.  (/ 7.0) is also interpreted as value of 1/7.
> 
> I don't care about the results of (-) and (/), these are indeed a bit
> obscure IMO.

I understand you have no use for those, that is what maybe had some
use somewhere.

If you know C language, do you think that hypothesis that it simply
came from C language, could be right?


-- 
Jean

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

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



  reply	other threads:[~2023-01-18 12:27 UTC|newest]

Thread overview: 149+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 20:53 How to make M-x TAB not work on (interactive) declaration? Jean Louis
2023-01-07 21:11 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-01-07 23:40   ` Jean Louis
2023-01-08  6:06 ` Eli Zaretskii
2023-01-08  6:19   ` Emanuel Berg
2023-01-09  4:49     ` Jean Louis
2023-01-09  6:26       ` algorithmic Lisp language (was: Re: How to make M-x TAB not work on (interactive) declaration?) Emanuel Berg
2023-01-09 19:30         ` Jean Louis
2023-01-09 19:32         ` Jean Louis
2023-01-08  6:21   ` How to make M-x TAB not work on (interactive) declaration? Jean Louis
2023-01-08  6:32     ` Emanuel Berg
2023-01-08 10:38     ` Eli Zaretskii
2023-01-08  8:34 ` Tassilo Horn
2023-01-08 11:01   ` Eli Zaretskii
2023-01-09 13:29     ` Tassilo Horn
2023-01-08 21:35   ` Jean Louis
2023-01-08 22:35     ` [External] : " Drew Adams
2023-01-09  0:24       ` Emanuel Berg
2023-01-09 19:47         ` Jean Louis
2023-01-10 23:28           ` Emanuel Berg
2023-01-13  6:21             ` (*)->1 Jean Louis
2023-01-14 12:03               ` (*)->1 Michael Heerdegen
2023-01-14 12:33                 ` (*)->1 Michael Heerdegen
2023-01-15 20:18           ` [External] : Re: How to make M-x TAB not work on (interactive) declaration? Rudolf Adamkovič
2023-01-15 20:57             ` Jean Louis
2023-01-15 22:33               ` Drew Adams
2023-01-15 23:10                 ` Emanuel Berg
2023-01-16 15:28                 ` Jean Louis
2023-01-16 17:07                   ` Drew Adams
2023-01-16 18:25                     ` Jean Louis
2023-01-17  2:20                       ` Drew Adams
2023-01-17  5:28                         ` tomas
2023-01-17 22:20                           ` Drew Adams
2023-01-18  5:14                             ` tomas
2023-01-18  5:26                               ` Emanuel Berg
2023-01-19 11:38                                 ` tomas
2023-01-19 11:51                                   ` Emanuel Berg
2023-01-21 14:05                                     ` tomas
2023-01-23 10:14                                       ` Robert Pluim
2023-01-23 16:44                                       ` Michael Heerdegen
2023-01-23 19:28                                         ` tomas
2023-01-18 17:27                               ` Drew Adams
2023-01-18 17:32                                 ` tomas
2023-01-18 14:32                             ` Jean Louis
2023-01-18 20:36                               ` Drew Adams
2023-01-19  9:05                                 ` (*) -> 1 Jean Louis
2023-01-19  9:41                                   ` Yuri Khan
2023-01-19 12:52                                   ` Anders Munch
2023-01-17  5:35                         ` [External] : Re: How to make M-x TAB not work on (interactive) declaration? Jean Louis
2023-01-17 15:59                           ` Yuri Khan
2023-01-17 16:42                             ` Jean Louis
2023-01-17 16:05                           ` Michael Heerdegen
2023-01-17 16:17                             ` Yuri Khan
2023-01-17 16:25                             ` tomas
2023-01-17 16:55                             ` (*) -> 1 Jean Louis
2023-01-17 17:52                               ` Michael Heerdegen
2023-01-17 18:11                                 ` Óscar Fuentes
2023-01-17 18:40                                   ` Jean Louis
2023-01-17 19:04                                     ` Óscar Fuentes
2023-01-18 13:15                                       ` Jean Louis
2023-01-18 14:37                                         ` Óscar Fuentes
2023-01-18 18:17                                         ` [External] : " Drew Adams
2023-01-17 19:35                                     ` Michael Heerdegen
2023-01-17 21:12                                   ` Michael Heerdegen
2023-01-17 22:01                                     ` Óscar Fuentes
2023-01-17 23:38                                       ` Michael Heerdegen
2023-01-18  7:50                                         ` Óscar Fuentes
2023-01-18  8:37                                           ` tomas
2023-01-18 12:46                                             ` Óscar Fuentes
2023-01-18 13:44                                               ` Michael Heerdegen
2023-01-18 14:07                                                 ` Óscar Fuentes
2023-01-18 16:19                                                   ` Andreas Eder
2023-01-18 17:14                                                     ` Óscar Fuentes
2023-01-17 18:18                                 ` Jean Louis
2023-01-17 11:52                         ` [External] : Re: How to make M-x TAB not work on (interactive) declaration? Michael Heerdegen
2023-01-15 21:08             ` Jean Louis
2023-01-16  5:02               ` Emanuel Berg
2023-01-16  5:38               ` tomas
2023-01-16 10:10                 ` Jean Louis
2023-01-16 10:41                   ` Yuri Khan
2023-01-16 15:26                     ` Jean Louis
2023-01-17  4:06                 ` Emanuel Berg
2023-01-17 14:00                   ` tomas
2023-01-17 22:43                     ` Emanuel Berg
2023-01-17 16:25                 ` Nick Dokos
2023-01-17 17:19                   ` Jean Louis
2023-02-11  4:38                     ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-02-11 10:54                       ` Jean Louis
2023-01-17 17:41                   ` Nick Dokos
2023-01-16  7:55               ` Yuri Khan
2023-01-16 10:16                 ` Jean Louis
2023-01-16 10:37                   ` Yuri Khan
2023-01-16 15:35                     ` Jean Louis
2023-01-16 15:59                       ` Yuri Khan
2023-01-16 16:14                         ` Jean Louis
2023-01-16 16:47                           ` tomas
2023-01-16 17:07                           ` Drew Adams
2023-01-16 18:41                             ` Jean Louis
2023-01-16 10:51                   ` Anders Munch
2023-01-16 15:38                     ` Jean Louis
2023-01-16 17:40                       ` Andreas Eder
2023-01-16 18:17                         ` tomas
2023-01-16 18:55                           ` Jean Louis
2023-01-16 19:14                             ` tomas
2023-01-16 18:46                         ` Jean Louis
2023-01-17  2:37                           ` Eduardo Ochs
2023-01-17  5:46                             ` (*) -> 1 Jean Louis
2023-01-17 15:56                               ` Michael Heerdegen
2023-01-17 16:29                                 ` Jean Louis
2023-01-17 16:43                                   ` tomas
2023-01-17 17:25                                     ` Jean Louis
2023-01-17 19:11                                       ` Nick Dokos
2023-01-17 17:17                                   ` Michael Heerdegen
2023-01-17 17:26                                     ` Jean Louis
2023-01-17 18:46                                       ` Michael Heerdegen
2023-01-17 18:51                                         ` Jean Louis
2023-01-17 18:04                                     ` Jean Louis
2023-01-17 18:28                                       ` Eduardo Ochs
2023-01-17 19:18                                       ` Michael Heerdegen
2023-01-18 12:27                                         ` Jean Louis [this message]
2023-01-18 13:37                                           ` Michael Heerdegen
2023-01-19  8:20                                             ` Jean Louis
2023-01-19 10:06                                               ` Tassilo Horn
2023-01-19 13:43                                               ` Michael Heerdegen
2023-01-19 14:42                                                 ` Jean Louis
2023-01-19 15:27                                                   ` tomas
2023-01-18 13:57                                           ` Óscar Fuentes
2023-01-19  8:32                                             ` Jean Louis
2023-01-19 16:51                                               ` Óscar Fuentes
2023-01-20  8:01                                                 ` Jean Louis
2023-01-18 14:25                                           ` Michael Heerdegen
2023-01-19  8:34                                             ` Jean Louis
2023-01-19 13:54                                               ` Michael Heerdegen
2023-01-19 14:54                                                 ` Jean Louis
2023-01-19 15:19                                                   ` Tassilo Horn
2023-01-19 15:46                                                   ` Michael Heerdegen
2023-01-19 17:38                                                   ` Dr Rainer Woitok
2023-01-20  7:31                                                     ` Jean Louis
2023-01-20 11:49                                                       ` Dr Rainer Woitok
2023-01-19 17:44                                                 ` [External] : " Drew Adams
2023-01-19 21:29                                                   ` Michael Heerdegen
2023-01-20  7:40                                                     ` Jean Louis
2023-01-20  8:47                                                       ` Emanuel Berg
2023-01-18  9:02                                 ` Anders Munch
2023-01-18 10:49                                   ` Michael Heerdegen
2023-01-18 11:10                                     ` Emanuel Berg
2023-01-18 12:48                                   ` Eli Zaretskii
2023-01-18 14:29                                     ` Michael Heerdegen
     [not found]                           ` <87k01lica7.fsf@eder.anydns.info>
2023-01-17 16:04                             ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8fly8k72s+iVJYF@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).