This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-22
Channels
- # aatree (2)
- # beginners (14)
- # boot (190)
- # cider (16)
- # cljs-dev (15)
- # cljsjs (6)
- # cljsrn (7)
- # clojure (101)
- # clojure-austin (26)
- # clojure-berlin (2)
- # clojure-estonia (4)
- # clojure-greece (53)
- # clojure-russia (46)
- # clojurescript (44)
- # core-async (12)
- # cursive (57)
- # data-science (49)
- # datomic (5)
- # emacs (8)
- # hoplon (92)
- # ldnclj (20)
- # lein-figwheel (22)
- # leiningen (4)
- # mount (37)
- # om (103)
- # onyx (26)
- # parinfer (70)
- # proton (6)
- # re-frame (32)
- # reagent (1)
- # yada (24)
Hi, suppose i have a vector of channels and I want to get a vector of results from taking one element from each channel. Is this possible? [I'd rather not have to resort to side-effecting doseq
but given limitations of core.async mentioned here https://github.com/clojure/core.async/wiki/Go-Block-Best-Practices it may be the only way).
Channels are stateful, so taking from channels produces a side effect (the channel changes).
Yes, but doseq
will not work for me as I want the entire vector of results and not to accumulate via mutation into an atom the results individually
In the end, I am swapping the results (as a vector) into an atom and using yet another atom to accumulate the results as they come in seems less than "functional"
i.e., the point of atoms/swap! is to isolate the mutating parts of your program to the minimal surface area-- if it weren't for the limitation of 'go' here this would be entirely do-able as operations over sets (with a final single swap!)