emacs-devel
[Top][All Lists]
Advanced

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

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


From: Lars Ingebrigtsen
Subject: Re: Making 'eq' == 'eql' in bignum branch
Date: Tue, 28 Aug 2018 03:33:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Clément Pit-Claudel <address@hidden> writes:

> I usually use 1.0e+INF and -1.0e+INF when I need a neutral element for
> min and max respectively, rather than most-positive-fixnum. 

Hey, nice tip.  I hadn't even considered those (well, I didn't know they
had a read syntax -- is that new?).  And I've already started using them
where I would previously have used most-positive-fixnum, like in this
code I just found myself typing:

(cl-sort films '<
         :key (lambda (e)
                (or (getf e :year) 1.0e+INF)))

This sorts a list of films by year, and sorts the ones with unknown
(nil) years to the end.  This would obviously previously have been a
problem in the year 2305843009213693951 CE on legacy 64-bit machines,
but my code is now future proof.

But anyway, as Richard implies, it's a read syntax that's strangely
difficult to remember.  Would it make sense to have a variable like
`positive-infinity' (etc) or `math-positive-infinity'?  Or perhaps we'll
all start remembering it after seeing it sprinkled throughout the source
code after a while.

Hm...  Probably the latter.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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