This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-16
Channels
- # adventofcode (43)
- # announcements (31)
- # aws (2)
- # babashka (58)
- # babashka-sci-dev (4)
- # beginners (107)
- # calva (11)
- # cider (25)
- # clj-commons (8)
- # clj-kondo (24)
- # clojure (35)
- # clojure-argentina (1)
- # clojure-europe (25)
- # clojure-italy (5)
- # clojure-nl (11)
- # clojure-norway (39)
- # clojure-spec (11)
- # clojure-uk (3)
- # conjure (2)
- # core-async (19)
- # cursive (33)
- # data-science (2)
- # datomic (50)
- # deps-new (1)
- # emacs (3)
- # events (4)
- # figwheel-main (10)
- # fulcro (63)
- # graalvm (7)
- # holy-lambda (17)
- # introduce-yourself (1)
- # java (15)
- # jobs (1)
- # jobs-discuss (7)
- # malli (24)
- # meander (16)
- # nextjournal (19)
- # off-topic (2)
- # polylith (4)
- # portal (10)
- # re-frame (3)
- # reagent (19)
- # reitit (14)
- # releases (2)
- # remote-jobs (1)
- # reveal (19)
- # shadow-cljs (1)
- # sql (21)
- # testing (4)
- # xtdb (22)
the latter will create and capture bindings and launch a go block on the go thread pool
I mean, I guess they are very similar
i see. i was thinking there was an easier way to end up with a channel with a single value on it but you’re right go
does quite a bit of state machine more than just channel with value
I think to-chan! will close the returned channel and the go one will not?
well to-chan! calls onto-chan! that uses a go loop, so they will both do that
I guess they both close
functionally, they will end up being pretty close
i see. thanks alex. the to-chan!
felt heavier to me at first blush but it seems clearly not. thanks for reasoning that out for me
if you insist on using channels as one shot things like java futures or javascript promises
if you use channels as queues that multiple values flow through, it doesn't line up with the way futures/promises are interpreted as monads
But channels implementing a "flow" and a "task" at the same time makes it ambiguous. Should a promise channel be used here?
if you are trying to emulate to-chan! or go without spinning up a go loop, then not using a promise-chan does that
Now to-chan!! is a lot lighter for the case of a single value