Hi,
Here's another patch from me:

The clojure.lang.Range type is implemented with integer type start and  
end indices. The core.clj range function should detect when an index  
doesn't fit inside an int and create an increasing sequence using  
iterate instead. The current implementation detects too large  
positive, but not too large negative ranges. The overflow occurs  
silently without throwing an exception.

Before:
user=> (take 1 (range -2147483649 0))
(2147483647)

After applying the patch (created against trunk r1159):
user=> (take 1 (range -2147483649 0))
(-2147483649)

I also made the range function slightly less conservative < vs <=  
wise. This shouldn't affect correctness but (range 0 2147483647) will  
now return a Range (after patch) instead of a LazyCons (before).


/Olov Lassus


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: support_large_negative_range.patch
Description: Binary data



Reply via email to