clj-commons / manifold

A compatibility layer for event-driven abstractions
1.02k stars 106 forks source link

transducer completion state going missing #146

Closed mccraigmccraig closed 6 years ago

mccraigmccraig commented 6 years ago

i thought the third take! should return {:foo 30 :bar 30} - or am i misunderstanding something ?

er-model.system> (def s (manifold.stream/->source [{:foo 10 :bar 10} {:foo 20 :bar 20} {:foo 30 :bar 30}]))
#'er-model.system/s
er-model.system> (def t (manifold.stream/transform (partition-by :foo) s))
#'er-model.system/t
er-model.system> @(manifold.stream/take! t)
[{:foo 10, :bar 10}]
er-model.system> @(manifold.stream/take! t)
[{:foo 20, :bar 20}]
er-model.system> @(manifold.stream/take! t)
nil
ztellman commented 6 years ago

No, that seems to be a reasonable expectation:

> (transduce (partition-by :foo) conj [] [{:foo 10 :bar 10} {:foo 20 :bar 20} {:foo 30 :bar 30}])
[[{:foo 10, :bar 10}] [{:foo 20, :bar 20}] [{:foo 30, :bar 30}]]

I'll look at how Manifold handles transducers and see if I can identify the issue.

ztellman commented 6 years ago

Hi, this was fixed a few months back in https://github.com/ztellman/manifold/pull/136, but I haven't pushed out a new release since then. If you target [manifold "0.1.7-alpha6"] everything should work as expected.