Hello! Very beginner core.async question. Shouldn't this code return the result of processing all go blocks asynchronously? When I run it in the REPL it only returns the result of processing one of the blocks at random
(async/<!!
(async/merge
(map #(go (let [channel (async/chan)]
(fetch_meo_data % channel)
(let [result (async/<! channel)]
(async/close! channel)
result)))
tv_channels)))
I would checkout the docstring for merge
you may want async/into
Thanks for the tip! Turns out I needed both. Merge joins all the channels and into collects them
(async/<!! (async/into '() (async/merge
(map
#(go (let
[channel (async/chan)
result (do
(fetch_meo_data % channel)
(handle-meo-response (async/<! channel)))]
(async/close! channel)
result))
tv_channels))))
I think (<!! (async/map list <seq of go blocks>))
would be even easier