On Mon, Jan 16, 2023 at 07:14:49PM +0300, Jean Louis wrote: > * Yuri Khan [2023-01-16 19:01]: > > On Mon, 16 Jan 2023 at 22:50, Jean Louis wrote: > > > > > There are no elements in this context. > > > > > > (+) ➜ 0 > > > > There is a list of elements, and the length of that list is zero. > > > > > Multiplication of zero elements is also zero: > > > (* 0 0) ➜ 0 > > > but Lisp: > > > (*) ➜ 1 > > > > You are conflating elements of zero value with a zero count of elements. > > > > You are not willing to understand. I suspect you also will not believe > > me if I tell you all my dogs have green hair. > > I am very willing to understand. This should not be place of laughing > me out because I keep asking questions. Again: the behaviour of Lisp's + and * is modeled after maths conventions. Assuming you've read both Wikipedia references I linked to you might understand why those conventions "make sense" (no they are not theorems or some such, just conventions, you notice that proofs and formulae are usually simpler). The mathematical things modeled by Lisp's + and * are the summation Σ and the product Π. In maths, the empty sum evaluates to 0, the empty product to 1 [1] [2] (for the last one: otherwise this would be at odds that a number raised to the zeroth power also yields 1). So why would Lisp, modeling numbers (roughly) after maths, deviate from math conventions? If you do functional programming, this corresponds nicely to anamorphisms [3]: you have a start value and a two-place funtion and calculate the next "start" value by combininb the old one with the next in the list. For sums, your start value would be zero. For products? Nah :) Cheers [1] "If the summation has no summands, then the evaluated sum is zero, because zero is the identity for addition. This is known as the empty sum." https://en.wikipedia.org/wiki/Sigma_notation#Special_cases [2] "[...] an empty product whose value is 1 -- regardless of the expression for the factors." https://en.wikipedia.org/wiki/Capital-pi_notation#Capital_pi_notation [3] Google called them "reduce" in their "map-reduce" framework, but they try to put their scent on everything. They didn't invent them. Oh, that's the way you can define aggregates in your beloved PostgreSQL, too. https://en.wikipedia.org/wiki/Anamorphism -- t