[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making 'eq' == 'eql' in bignum branch

From: Pip Cet
Subject: Re: Making 'eq' == 'eql' in bignum branch
Date: Tue, 28 Aug 2018 22:57:50 +0000

On Tue, Aug 28, 2018 at 6:19 PM Clément Pit-Claudel
<address@hidden> wrote:
> On 2018-08-28 08:15, Stefan Monnier wrote:
> >> If “1.0e+INF” is hard to remember, how about defining symbols “+inifinity”
> > Pip's suggestion is to use (max) for that.
> I think you read Pip's suggestion backward: (max) would return -infinity, not 
> +infinity.  (Which makes sense, since you want max to distribute over list 
> concatenation)
> FWIW, I'm not a fan of using either (min) or (max) to represent minus 
> infinity; it looks a bit odd.  Many other languages have an infinity constant 
> already, so that pattern is well established; making (max) an alias for 
> either of the infinities is prone to introducing confusion.

It's more natural in code than it sounds at first: you use (min) when
finding a minimum, (max) when finding a maximum. However, if there is
a good name for it, an infinity constant is perfectly fine. Such a
name should make clear that we're talking about a signed infinity, not
one that makes 1/x continuous by adding a point at infinity to the
real line.

Signed infinities are convenient symbols, but they're not numbers; I
recall the horrified reaction of a mathematician when I told her about
IEEE infinities (she thought I was making it up about NaNs).

I think it's all so confusing that it would be best to accept the
slight performance cost of having a function like

(defun minpair (alist)
  "Return an element of ALIST for which (cdr X) is minimal."

and using it consistently, in addition to defining (min), (max),
defining a pair of infinity constants, making `min' and `max' ignore
nil arguments, and changing `eq' to work on infinities. And maybe
changing the read and print syntax for infinities.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]