You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if it shouldn't be requalified as a core.async bug: a closed transducing channel doesn't remember having called the completing arity of its rf:
user=> (def c (a/chan 1 (fn [rf] (fn ([] (rf)) ([acc] (rf (unreduced (rf acc [:completed (System/currentTimeMillis)])))) ([acc _] acc)))))
#'user/c
user=> (a/close! c)
nil
user=> (a/<!! c)
[:completed 1603187902345]
user=> (a/<!! c)
[:completed 1603187908246]
user=> (a/<!! c)
[:completed 1603187909392]
user=> (a/<!! c)
[:completed 1603187910475]
user=> (a/<!! c)
[:completed 1603187911584]
It has a broad impact: all transducers that flush on completion should keep track of having completed.
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?
The text was updated successfully, but these errors were encountered: