From: Jean Louis <bugs@gnu.support>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: help-gnu-emacs@gnu.org
Subject: Re: (*) -> 1
Date: Fri, 20 Jan 2023 11:01:52 +0300 [thread overview]
Message-ID: <Y8pKcCryS5upxGP6@protected.localdomain> (raw)
In-Reply-To: <87o7qu8o2c.fsf@telefonica.net>
* Óscar Fuentes <ofv@wanadoo.es> [2023-01-19 19:53]:
> > 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?
That is quite alright because:
2 + 3 + 4 =
2 * 3 * 4 =
is just fine and useful for human. People add numbers, multiply
numbers.
What is also useful is when factor is missing, for debugger to raise
the error.
Multiplication with single argument like here:
(* 4) ➜ 4
Should be prevented by simply resulting with that single argument,
instead of trying to multiply what is not necessary.
(let ((my-random-numbers (make-list (1+ (random 3)) (+ 2 (random 5)))))
my-random-numbers) ➜ (4 4 4)
;; I do not know how to make better example for `plus' function which
;; require 2 addends
(defun plus (addend-1 addend-2 &rest addends)
(eval `(+ addend-1 addend-2 ,@addends)))
(plus) -- error
(plus 2) -- error
(plus 2 2) ➜ 4
(plus 2 2 3) ➜ 7
Thus in some complex operation, programmer better test what arguments are given to `apply'.
(let ((my-random-numbers (make-list (1+ (random 3)) (+ 2 (random 5)))))
(prog2
(message "List: %s" my-random-numbers)
(cond ((cadr my-random-numbers) (apply #'plus my-random-numbers))
((car my-random-numbers) (car my-random-numbers))
(t (warn "Did not get 2 factors!"))))) ➜ 6
in cases where radnom number of factors is given to multiplication, it
seem to me better to take care of arguments and not at all `apply' or
`reduce' as that way programmer can hardly find out what was actually
the case.
The explanation that (*) is made only for programmers to minimize
errors sounds rationalizing.
I believe there is some use of (*) which is probably in some old book
or sources of Lisp in first place.
> > ~$ pil
> > : (*)
> > -> NIL
> > : (+)
> > -> NIL
> > : (apply '* '(2 3))
> > -> 6
>
> What's the output of
>
> (apply '* '())
>
> in PicoLisp?
Emacs
-----
(apply '* '(2 2)) ➜ 4
(apply '* '()) ➜ 1
PicoLisp
--------
(apply '* '(2 2)) ➜ 4
(apply '* '())
-> NIL
That is my natural expectation. I find it useful to have NIL as that
would raise my attention that I have not provided arguments to
multiplication.
> > 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.
I understand your statement above as following:
- in Elisp, there is no particular practical use for (*) ➜ 1
- there is theoretical only, and representativ use, as (*) ➜ 1 talks
about summation for finite sequences
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
next prev parent reply other threads:[~2023-01-20 8:01 UTC|newest]
Thread overview: 167+ 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-19 8:37 ` Jean Louis
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
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 [this message]
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-20 7:05 ` Jean Louis
2023-01-20 8:52 ` Tassilo Horn
2023-01-20 12:46 ` Jean Louis
2023-01-20 13:02 ` Tassilo Horn
2023-01-20 16:06 ` Jean Louis
2023-01-21 8:19 ` Tassilo Horn
2023-01-22 4:30 ` Emanuel Berg
2023-01-22 6:55 ` Jean Louis
2023-01-22 10:56 ` Emanuel Berg
2023-01-23 3:40 ` [External] : " Drew Adams
2023-01-22 14:34 ` Akib Azmain Turja
2023-01-23 2:23 ` Emanuel Berg
2023-01-23 5:37 ` Jean Louis
2023-01-23 5:55 ` Jean Louis
2023-01-24 2:33 ` Emanuel Berg
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 14:54 ` Jean Louis
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-20 7:33 ` Jean Louis
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y8pKcCryS5upxGP6@protected.localdomain \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
--cc=ofv@wanadoo.es \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.