Skip to content

Infinite loop with stateful transducer on core.async channel  #37

@pukkamustard

Description

@pukkamustard

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions