[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: |
Mon, 16 Jan 2023 21:41:18 +0300 |
User-agent: |
Mutt/2.2.9+54 (af2080d) (2022-11-21) |
* Drew Adams <drew.adams@oracle.com> [2023-01-16 20:07]:
> I think the replies you've gotten already might well help you
> understand. Please consider rereading them.
I do not dispute that group theory exists, or identity, and it is part
of mathematic.
I do not see relation between identity and lisp function which is
supposed to give product of multiplication or sum of addition, and I
can't imagine that Lisp authors did that to those functions for reasons
to avoid `apply' function to fail.
There are X number of mathematical stuff that is not represented in
Lisp because it should not be there, a function should do one thing well.
What is missing in my understanding is:
- purpose of (*) ➜ 1, (-) ➜ 0 and (+) ➜ 0 as I do not understand how I
would apply it else but making a funny Christmass tree in obscured
programming and relation to Lisp. I have tried searching for
references but can't find.
(defun m (n)
(let ((m))
(dotimes (b n)
(setq m (cons "(*)" m)))
(concat "(+" (string-join m) ")")))
(let ((first 1))
(insert "\n")
(while (<= first 10)
(let ((second 1))
(while (<= second 10)
(insert "(*" (m first)(m second) ")\n")
(setq second (1+ second)))
(setq first (1+ first)))))
One reference to it I find in "Common Lisp - A Gentle Introduction to
Symbolic Computing":
> Suppose x and y are lists. (REDUCE #’+ (APPEND x y)) should produce
> the same value as the sum of (REDUCE #’+ x) and (REDUCE #’+ y). If y
> is NIL, then (APPEND x y) equals x, so (REDUCE #’+ y) has to return
> zero. Zero is the identity value for addition. That’s why calling +
> with no arguments returns zero. Similarly, calling * with no arguments
> returns one because one is the multiplicative identity.
Let's compare:
(let ((x '(3 3 3))
(y '(4 4 4)))
(reduce #'* (append x y))) ➜ 1728
Same in Common Lisp
(let ((x '(3 3 3))
(y '(4 4 4)))
(+ (reduce #'+ x) (reduce #'+ y))) ➜ 21
Same in Common Lisp
Am I wrong here making sum how it said I should make?
(let ((x '(3 3 3))
(y nil))
(append x y)) ➜ (3 3 3)
I cannot see that (append x y) equals x -- I cannot follow the example
(let ((x '(3 3 3))
(y nil))
(reduce #'+ y)) ➜ 0
This is correct as in example
Again I read "That's why calling + with no arguments returns zero" and do they
mean that "why" is with reason to make function `reduce' work similarly like to
make `apply' work?
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, (continued)
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Jean Louis, 2023/01/17
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Nick Dokos, 2023/01/17
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Yuri Khan, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Jean Louis, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Yuri Khan, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Jean Louis, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Yuri Khan, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Jean Louis, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, tomas, 2023/01/16
- RE: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Drew Adams, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?,
Jean Louis <=
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Anders Munch, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Jean Louis, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Andreas Eder, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, tomas, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Jean Louis, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, tomas, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Jean Louis, 2023/01/16
- Re: [External] : Re: How to make M-x TAB not work on (interactive) declaration?, Eduardo Ochs, 2023/01/16
- (*) -> 1, Jean Louis, 2023/01/17
- Re: (*) -> 1, Michael Heerdegen, 2023/01/17