Bug or question: multiplex -> partition -> unpredictable/unordered output?
lnostdal opened this issue · comments
Lars Rune Nøstdal commented
> (dotimes [i 5]
(println (sequence (comp (xforms/multiplex [(map inc)
(map dec)])
(xforms/partition 2)
(map (fn [[^long a ^long b]] (- a b))))
(range 0 10))))
(2 2 2 2 2 2 2 2 2 2)
(-2 -2 -2 -2 -2 -2 -2 -2 -2 -2)
(-2 -2 -2 -2 -2 -2 -2 -2 -2 -2)
(-2 -2 -2 -2 -2 -2 -2 -2 -2 -2)
(2 2 2 2 2 2 2 2 2 2)
...shouldn't this give the same output on every run?
Christophe Grand commented
multiplex
is not mapcat
.
Each multiplexed transducer may have it's own rhythm (eg output 0, 1 or many items when processing one input item), there's no guarantee on the ordering of emitted values between transducers.