If I have a vector of channels, what is the easiest way to end up with a vector of the first result from each, ordering intact?
I tried (for [c chans] (<! c))
but it errors with <! not used in a go block
(even when it is)
e.g. (go (into [] (for [c chans] (<! c))))
still errors
I'm basically looking for the equivalent of Promise.all
(for the JS people) for a vector of channels that only emit one message (typically (map f vals)
where f
uses a go
block)
There's clojure.core.async/map
https://clojuredocs.org/clojure.core.async/map
(<!! (clojure.core.async/map vector your-chans))
ya
I tried it, but I misread it first. passing vector
as the f
does what I want 👍