Is there a reason why tap
doesn't have a transducer form? Is there a better way to link a mult to another channel via a transducer than through an intermediate channel?
back up and state what problem you’re trying to solve
tap is like prn - it is hard for me to meaningful say that either should have a “transducer form” or even what that means
Well, what I want is that I have a channel, which I want to distribute to different sinks, for which I currently use a mult and a few taps to the sink channels. That works quite well. Now I want to subject each of those connections to a different transducer for each sink, and I found no straightforward way to do that.
What I meant by transducer form was something similar to pipeline, which as far as I know doesn't work on mults. I actually thought that pipe
had a call signature with a transducer arg too, but apparently that's not the case
can you supply a transducer to the sink channels? I'm sure I'm missing something...
No, it's a valid question, but I can not, because they are fed from different sources. Transforming everything to a common format is actually one of the reasons I need the transducers
Not sure I understand the issue, tap
does not take a transducer, but the channel you give it does...
oh, hang on - you are talking about tap in core.async, not tap>, the new function in Clojure 1.10
so completely ignore what I said before :)
but, what fmjrey said - tap
takes a channel, which can have a transducer applied to it
Ah! Did not know about the new tap
😉
Ok, so there is no straightforward solution, I have the sink channels provided to me and can not apply transducers to them afterwards
you could connect new ones with pipe
what you said about using pipe
would work too, you supply your own transducer to the channel at the end of the pipe you control - that's where the "transducer arg" analog would be in your q above
ok, so I create a new channel with a transducer, tap
into that, and pipe
from there to the sink, did I understand that correctly?
Or maybe use transduce
?
sorry transduce reduces, ignore my comment
if that works for you, yes. it sounded just now like you weren't in control of the sink channels that got supplied to you, so that's the reason for using an additional channel that you do control, supplying a transducer to it when you create it, and hooking it/them up to the sink channel/s via pipe
.