Fix non-completion bug in iterator
This commit is contained in:
parent
51b61f3889
commit
6145006946
2 changed files with 6 additions and 1 deletions
|
|
@ -483,7 +483,9 @@
|
||||||
(let [acc (rf nil (.next src-iterator))]
|
(let [acc (rf nil (.next src-iterator))]
|
||||||
(when (reduced? acc) (vreset! vopen false))
|
(when (reduced? acc) (vreset! vopen false))
|
||||||
(recur))
|
(recur))
|
||||||
false))]
|
(do
|
||||||
|
(rf nil)
|
||||||
|
false)))]
|
||||||
(reify java.util.Iterator
|
(reify java.util.Iterator
|
||||||
(hasNext [_]
|
(hasNext [_]
|
||||||
(ensure-next))
|
(ensure-next))
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,9 @@
|
||||||
[[[0 1] [2 3] [4 5] [6 7]]])))
|
[[[0 1] [2 3] [4 5] [6 7]]])))
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
|
(deftest iterator
|
||||||
|
(is (= [[0 1] [1 2] [2 3] [3 4] [4]] (iterator-seq (x/iterator (x/partition 2 1 nil) (.iterator (range 5)))))))
|
||||||
|
|
||||||
(deftest window-by-time
|
(deftest window-by-time
|
||||||
(is (= (into
|
(is (= (into
|
||||||
[]
|
[]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue