core-async

2019-01-03T16:13:37.020100Z

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?

alexmiller 2019-01-03T16:20:44.021300Z

back up and state what problem you’re trying to solve

alexmiller 2019-01-03T16:22:21.022300Z

tap is like prn - it is hard for me to meaningful say that either should have a “transducer form” or even what that means

2019-01-03T16:35:56.025400Z

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

gws 2019-01-03T16:54:21.027900Z

can you supply a transducer to the sink channels? I'm sure I'm missing something...

2019-01-03T16:55:23.028900Z

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

fmjrey 2019-01-03T16:58:12.029800Z

Not sure I understand the issue, tap does not take a transducer, but the channel you give it does...

alexmiller 2019-01-03T16:58:18.030Z

oh, hang on - you are talking about tap in core.async, not tap>, the new function in Clojure 1.10

alexmiller 2019-01-03T16:59:22.030400Z

so completely ignore what I said before :)

alexmiller 2019-01-03T17:00:19.030900Z

but, what fmjrey said - tap takes a channel, which can have a transducer applied to it

2019-01-03T17:01:30.031900Z

Ah! Did not know about the new tap 😉

2019-01-03T17:02:05.032600Z

Ok, so there is no straightforward solution, I have the sink channels provided to me and can not apply transducers to them afterwards

alexmiller 2019-01-03T17:02:45.033600Z

you could connect new ones with pipe

gws 2019-01-03T17:03:35.034800Z

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

2019-01-03T17:04:50.035500Z

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?

fmjrey 2019-01-03T17:07:30.036700Z

Or maybe use transduce?

fmjrey 2019-01-03T17:08:35.037500Z

sorry transduce reduces, ignore my comment

gws 2019-01-03T17:08:59.037600Z

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.