Michael Heerdegen <

[hidden email]> wrote:

> I want to suggest to make the functions `max' and `min' accept zero

> arguments, with

>

> (max) => negative infinity

> (min) => positive infinity

>

> That would be mathematically consistent

For _current_ their implementation.

As you know, like most functions that operate on numbers, ‘min’ and ‘max’ really accept _different_ types of objects: integers ‘fixnums’, IEEE-754 inexact numbers ‘flonums’, and context-aware buffer positions ‘markers’. Return value is coerced to the type that is sort of common denominator of types of arguments. But what should be used if there are none? Whatever can be the most minimal / maximal now?

But once upon a time Emacs did not support flonums at all, so using that rule the choice for an identity value for ‘min’ (if we reject the idea to return some marker in some buffer as an absurd) was most-positive-fixnum.

Note, how this is unlike choosing that (+) ⇒ 0 and (*) ⇒ 1, than 0.0 and 1.0 resp., because (= 0 0.0) and (= 1 1.0) while, of course, (/= +1.0e+INF most-positive-fixnum). And imagine what a mess it would be, if someone indeed had done this?

In short, I believe, other languages (including kindred ones: Scheme and Common Lisp) are absolutely right in treating (max) and (min) as errors.

> and would offer an easier to remember syntax to specify the infinities (at least for mathematicians). I hate the read syntax suggested in the manual, I have to look it up every single time.

What reader syntax would you prefer? If Schemeʼs +inf.0 and -inf.0, then note, that they are valid symbols in Elisp. That is, you can perfectly do:

(defconst +inf.0 +1.0e+INF)

(defconst -inf.0 -1.0e+INF)

> (at least for mathematicians)

As for that regard, whatʼs wrong with, (/ +1.0 0) and (/ -1.0 0)?

BTW, I am surprised to hear, that IEEE-754-infinities are so much used in Elisp.