Fork me on GitHub
#core-async
<
2017-06-09
>
kkruit16:06:59

Can anyone help me see what i'm doing wrong with my transducer it seems to work for collections but not channels. When I log it looks like the 1 arity function gets called every input and it only gets called once when I run with a collection.

kkruit16:06:34

the channel also seems to be calling the let [prev (volatile! [])] every time as well.

hiredman16:06:43

hard to say without seeing the code, but in general, I would not use a stateful transducer with a channel, ever

hiredman16:06:45

I would add a println before the let of prev to verify it is being called more than once

hiredman16:06:12

if it is actually being executed more than once, make sure you aren't creating more than one channel that uses chunk-of and your results aren't being confused

kkruit16:06:00

I think it may because i'm using pipeline? So if you wouldn't use a stateful transducer would you just create a new channel with the "chunked" results?

Alex Miller (Clojure team)16:06:07

I think there’s actually a ticket about this in core.async

hiredman16:06:34

yeah, pipeline is exactly why I would shy away from stateful transducers

kkruit16:06:58

Okay, thanks!