This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-21
Channels
- # announcements (11)
- # architecture (8)
- # aws (7)
- # babashka (1)
- # beginners (55)
- # calva (52)
- # cider (4)
- # clj-kondo (5)
- # clojure (12)
- # clojure-europe (7)
- # clojure-uk (3)
- # clojurescript (40)
- # clr (1)
- # conjure (5)
- # data-oriented-programming (7)
- # datomic (8)
- # emacs (3)
- # events (1)
- # graphql (2)
- # honeysql (5)
- # lsp (7)
- # missionary (24)
- # nbb (10)
- # off-topic (12)
- # pathom (5)
- # reagent (9)
- # reitit (4)
- # schema (1)
- # sci (9)
- # shadow-cljs (2)
- # specter (6)
- # tools-deps (4)
- # xtdb (13)
(m/? (m/reduce
conj
(m/ap (let [x (m/?> (m/seed [1 2 3 4 5]))]
(if (= 2 x)
(m/?> m/none)
x)))))
;; => [1 3 4 5]
(m/? (m/reduce
conj
(m/ap (let [x (m/?> (m/eduction (take-while #(< % 2))
(m/seed [1 2 3 4 5])))]
x))))
In case that i'm working with unbound flow, e.g. some thing from (m/observe ..)
or (m/watch ..)
, how to signal for the flow to done ?
((m/reduce (fn [_ x]
(prn "X" x))
nil
(m/ap
(m/?> m/none)
(let [x (m/?> (m/watch _atom1))]
(if (= 5 x)
(m/?> m/none)
x)))
)
#(prn "done" %)
#(prn "fail" %))
((m/reduce (fn [_ x]
(prn "X" x))
nil
(m/ap
(let [x (m/?> (m/watch _atom1))]
(if (= 5 x)
(m/?> m/none)
x)))
)
#(prn "done" %)
#(prn "fail" %))
This is the correct one, sorryYes, that's should work,.. but probably my real question is there a way to signal termination from the inside, e.g. in case we use (m/observe ..) we want to stop based on specific event value