When running a stateful transducer on a core.async channel I get an unexpected behavior:
(go (println
(<! (let [c (async/chan 1 xforms/count)]
(async/onto-chan! c (range 5))
(async/into []
(async/take 10 c))))))
Outputs:
[5 5 5 5 5 5 5 5 5 5]
Expected output:
[5]
When running the same transducer on a sequence:
(into [] xforms/count (range 5))
I get the expected outcome ([5).
I have posted a question on ask.clojure.org (https://ask.clojure.org/index.php/9529/infinite-loop-with-stateful-transducer-core-async-channel). A fix has been provided there but I don't understand what is going. I am not sure if this is a bug in xforms or expected behavior. Maybe you could provide some insight?
When running a stateful transducer on a core.async channel I get an unexpected behavior:
Outputs:
[5 5 5 5 5 5 5 5 5 5]Expected output:
[5]When running the same transducer on a sequence:
I get the expected outcome (
[5).I have posted a question on ask.clojure.org (https://ask.clojure.org/index.php/9529/infinite-loop-with-stateful-transducer-core-async-channel). A fix has been provided there but I don't understand what is going. I am not sure if this is a bug in xforms or expected behavior. Maybe you could provide some insight?