On Jun 23, 2009, at 6:41 PM, Chouser wrote:
On Tue, Jun 23, 2009 at 5:15 PM, Stephen C. Gilardi<[email protected]> wrote:http://groups.google.com/group/clojure/browse_frm/thread/5e665ce7a318f44a/158419414f9150a0?lnk=gst&q=%3Ainfinity#158419414f9150a0Gah, I stole your idea! And your name was better, too. Sorry about that, --Chouser
Thanks, but I wasn't offended even a little. :-)I was happy to see it discussed again and thought my previous post could be useful for that.
I looked at what it would take to implement :infinity support in range and it seems it could be efficient and not too ugly.
Joshua's suggestion of a clojure.core name for Double/ POSITIVE_INFINITY sounds possibly generally useful and could be made efficient in range by using it as a marker rather than for every comparison with end.
(in-ns 'clojure.core)
(def +infinity Double/POSITIVE_INFINITY)
(def -infinity Double/NEGATIVE_INFINITY)
...
user=> +infinity
Infinity
user=> (- +infinity)
-Infinity
user=> (< 2 +infinity)
true
user=> (> 2 +infinity)
false
user=>(- (- +infinity) -infinity)
NaN
There may be potential pitfalls, but so far I thing these would useful
additions to Clojure's support for numbers.
Cheers, --Steve
smime.p7s
Description: S/MIME cryptographic signature
