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)
So the culprit is clojure.lang.LongRange/create.