This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-13
Channels
- # admin-announcements (6)
- # beginners (19)
- # boot (1)
- # cbus (2)
- # cider (3)
- # clara (24)
- # cljs-dev (4)
- # cljsrn (18)
- # clojure (168)
- # clojure-boston (1)
- # clojure-dev (55)
- # clojure-russia (199)
- # clojure-sg (2)
- # clojurescript (38)
- # clojurex (1)
- # core-async (15)
- # css (16)
- # cursive (62)
- # datomic (23)
- # editors-rus (17)
- # events (3)
- # funcool (1)
- # hoplon (360)
- # ldnclj (37)
- # lein-figwheel (11)
- # leiningen (1)
- # nginx (1)
- # off-topic (13)
- # om (361)
- # onyx (1)
- # re-frame (56)
- # reagent (24)
- # robots (1)
- # spacemacs (46)
- # yada (9)
Hello, a short question. I have a function which is called, when a message is received. Than it puts the message into a channel with
(go (>! chan msg))
in another ns i take this channel and print it to the repl with (go (println (<! chan))
. When I now send a message, the channelcontent is only printed once. Doesn’t the println take the value out of the channel and unblocks it?@danielgrosse: so you’re sending multiple messages but only the first one gets printed out?
Yes. just discovered, I had to change it to
(go (while true (println (<! chan))))
to get it workyou also might wanna look into https://clojure.github.io/core.async/index.html#clojure.core.async/put!
(see also https://github.com/clojure/core.async/wiki/Go-Block-Best-Practices, which i found super helpful)
What if i put continuous something into the channel without taking it out. Will it block anytime?