Created http://dev.clojure.org/jira/browse/CLJ-1709 and
http://dev.clojure.org/jira/browse/CLJ-1710 around the two issues.

On Sat, Apr 18, 2015 at 4:08 PM, Beau Fabry <imf...@gmail.com> wrote:

> Ouch. Suspect this is the problem
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LongRange.java#L161
>
> Pretty sure that boolean should be round the other way.
>
>
> On Saturday, April 18, 2015 at 12:32:40 PM UTC-7, Mathias De Wachter wrote:
>>
>> Hi,
>>
>> this looks like quite a serious bug to me (at least it messed up my
>> project):
>>
>> First taking the code taken from grimoire:
>>
>> clojurechess.position> (defn range
>>   "Returns a lazy seq of nums from start (inclusive) to end
>>   (exclusive), by step, where start defaults to 0, step to 1, and end to
>>   infinity. When step is equal to 0, returns an infinite sequence of
>>   start. When start is equal to end, returns empty list."
>>   {:added "1.0"
>>    :static true}
>>   ([] (range 0 Double/POSITIVE_INFINITY 1))
>>   ([end] (range 0 end 1))
>>   ([start end] (range start end 1))
>>   ([start end step]
>>    (lazy-seq
>>     (let [b (chunk-buffer 32)
>>           comp (cond (or (zero? step) (= start end)) not=
>>                      (pos? step) <
>>                      (neg? step) >)]
>>       (loop [i start]
>>         (if (and (< (count b) 32)
>>                  (comp i end))
>>           (do
>>             (chunk-append b i)
>>             (recur (+ i step)))
>>           (chunk-cons (chunk b)
>>                       (when (comp i end)
>>                         (range i end step)))))))))
>> WARNING: range already refers to: #'clojure.core/range in namespace:
>> clojurechess.position, being replaced by: #'clojurechess.position/range
>> #'clojurechess.position/range
>> clojurechess.position> (range 0 11 2)
>> (0 2 4 6 8 10)
>>
>> which is what I'd expect and relied on.
>>
>> Now, looking at the new code:
>>
>> clojurechess.position> (clojure.repl/source clojure.core/range)
>> (defn range
>>   "Returns a lazy seq of nums from start (inclusive) to end
>>   (exclusive), by step, where start defaults to 0, step to 1, and end to
>>   infinity. When step is equal to 0, returns an infinite sequence of
>>   start. When start is equal to end, returns empty list."
>>   {:added "1.0"
>>    :static true}
>>   ([]
>>    (iterate inc' 0))
>>   ([end]
>>    (if (instance? Long end)
>>      (clojure.lang.LongRange/create end)
>>      (clojure.lang.Range/create end)))
>>   ([start end]
>>    (if (and (instance? Long start) (instance? Long end))
>>      (clojure.lang.LongRange/create start end)
>>      (clojure.lang.Range/create start end)))
>>   ([start end step]
>>    (if (and (instance? Long start) (instance? Long end) (instance? Long
>> step))
>>      (clojure.lang.LongRange/create start end step)
>>      (clojure.lang.Range/create start end step))))
>> nil
>> clojurechess.position> (clojure.lang.Range/create 0 11 2)
>> (0 2 4 6 8 10)
>> clojurechess.position> (clojure.lang.LongRange/create 0 11 2)
>> (0 2 4 6 8)
>> clojurechess.position> (clojure.core/range 0 11 2)
>> (0 2 4 6 8)
>>
>> So the culprit is clojure.lang.LongRange/create.
>>
>>  --
> 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
> Note that posts from new members are moderated - please be patient with
> your first post.
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to