This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-11
Channels
- # admin-announcements (36)
- # beginners (1)
- # boot (267)
- # cider (19)
- # cljs-dev (12)
- # clojure (149)
- # clojure-austin (4)
- # clojure-canada (1)
- # clojure-czech (3)
- # clojure-dev (31)
- # clojure-japan (2)
- # clojure-uk (22)
- # clojurebridge (3)
- # clojurescript (314)
- # clojutre (18)
- # core-async (8)
- # cursive (4)
- # datascript (1)
- # datomic (27)
- # editors (2)
- # events (80)
- # hoplon (13)
- # javascript (2)
- # jobs (5)
- # ldnclj (12)
- # ldnproclodo (1)
- # off-topic (4)
- # re-frame (21)
- # reagent (87)
- # testing (13)
How can I map a hash of keywords to channels to a hash of keywords to the first value on those channels?
But for
wraps the <!
within an inner function and out the jurisdiction of the go
macro.
Totally untested, but I wonder if something like this might work?
(def firsts-only-chans
(map (fn [[k c]]
[k (async/take 1 %)])
my-chans))
(def ks-to-vals-chan
(map (fn [[k c]]
(async/map (partial vector k) [c]))
ks-to-chans))
(async/into {} ks-to-vals-chan)
The approach at least avoids the problem where code escapes the go block.
Maybe there is a much more straightforward transducer-based solution to this.