This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-24
Channels
- # beginners (15)
- # boot (4)
- # cider (1)
- # cljs-dev (2)
- # cljsrn (5)
- # clojure (124)
- # clojure-france (2)
- # clojure-russia (22)
- # clojure-uk (10)
- # clojurescript (50)
- # core-async (5)
- # cursive (3)
- # datomic (8)
- # emacs (2)
- # fulcro (10)
- # hoplon (8)
- # jobs (4)
- # luminus (2)
- # lumo (7)
- # off-topic (14)
- # portkey (7)
- # re-frame (22)
- # reagent (2)
- # shadow-cljs (3)
- # spacemacs (1)
- # yada (26)
I found myself writing code like this several times:
(defn watch-scan-progress [panel progress]
(async/go-loop [value (async/<! progress)]
(dispatch [:update-scan-progress panel value])
(recur (async/<! progress))))
where the only difference is in code between getting value from channel and recuring to it again
I was thinking if I can generalize that into a function or something, but I had a problem with go macro not allowing that
basically I have 2 instances of that ATM and I'm about to wtite it 3rd time https://github.com/YurySolovyov/eion/blob/1ccb5913b0bba22dadeef8770d4bec528b89f993/src/eion/renderer/channels.cljs#L43-L56
what I think I want is a general function or macro to say something like (watch-chan progress-channel (fn [val] (foo val)))
or something along these lines