Fork me on GitHub
#core-async
<
2016-09-30
>
danielcompton01:09:36

Is there a way to combine multiple core.async channels, but take all from the first until it is closed, then all from the second, e.t.c.?

danielcompton01:09:46

Essentially a concat but on channels instead of a lazy seq

danielcompton01:09:22

(vec (concat
       (<! (async/into [] schedule-ch))
       (<! (async/into [] cp-ch))
       (<! (async/into [] c-ch))))
which works but feels inelegant

noisesmith19:09:35

well, that could be simplified with a plain old reduce over a vector of channels

noisesmith19:09:54

(reduce #(into % (<! (async/into [] %2)) [] [schedule-ch cp-ch c-ch])

ghadi21:09:49

the reduce won't work because core.async/go doesn't rewrite over function boundaries

ghadi21:09:01

(the function being anonymous there)