This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-28
Channels
- # adventofcode (2)
- # aleph (4)
- # announcements (3)
- # asami (13)
- # babashka (27)
- # beginners (74)
- # clj-kondo (18)
- # cljdoc (1)
- # cljs-dev (27)
- # cljsrn (5)
- # clojure (75)
- # clojure-australia (5)
- # clojure-europe (25)
- # clojure-uk (2)
- # conjure (1)
- # core-logic (1)
- # deps-new (1)
- # fulcro (13)
- # gratitude (8)
- # honeysql (1)
- # lsp (24)
- # missionary (45)
- # mount (2)
- # nextjournal (24)
- # off-topic (10)
- # pathom (5)
- # portal (3)
- # releases (1)
- # shadow-cljs (7)
- # specter (1)
- # tools-deps (1)
why is it problematic
say we have an event bus that accepts either functions that execute or ap
that, when executed, return functions that are merged back to the bus
it probably doesn't matter much, but ap/sp
could be a separate type that implements IFn/invoke
currently, if a function could take a function, ap or sp, there is no way to know how to handle it
I know I can work around this by creating a new ap
based on the same input, but maybe there is a simpler way
@U053XQP4S I think I found a bug
basically it only works with m/watch
, which after thinking about it is even understandable, but the question is whether it should work that way
I wanted to create an event bus that I could subscribe and listen as many times as I needed
stream!
has pretty much the same semantics has Rx's .share
and handles backpressure like core.async mult
/ tap
I suspect I'm misunderstanding something, but if I give myself a moment, it will probably pop into my head in a moment
That's probably not what you had in mind, because it doesn't work either http://ix.io/3GrM
(def box (m/mbx))
(box 1)
(def c
((m/reactor
(let [>f (m/stream! (m/ap (loop [] (m/amb> (m/? box) (recur)))))]
(m/stream! (m/ap (println :r1 (m/?> >f))))
(m/stream! (m/ap (println :r2 (m/?> >f))))))
prn prn))
;; :r1 1
;; :r2 1
(box 2)
;; :r1 2
;; :r2 2
note how the first event is properly propagated to both listeners, even thought they were registered after, this is a classic FRP problem that Rx fails to solve