Fork me on GitHub

Is there an interactive playground where people can play around with missionary?

Dustin Getz13:07:53

Seeking contractor – this work involves using missionary


Once I created a flow with something like observe how could I get a flow that contains the values from this flow but also additional ones that are triggered ad-hoc?


for context: I’m working with a messaging API where you can subscribe and send but messages sent by yourself will not be broadcast to subscribers. So now I’m trying to create a flow that has the events coming from subscribe as well as an event whenever you send a message.


(defn both "Merge two flows" [>x >y]
  (m/ap (m/?> (m/amb= >x >y))))

(def send! (m/mbx))

(def cancel
  ((->> (m/observe (fn [!] (def sub !) #()))
     (both (m/ap (m/? (m/?> (m/seed (repeat send!))))))
     (m/reduce #(prn %2) nil))
   prn prn))

(sub 1)
(send! :a)
(sub 2)
(send! :b)

👀 1
🙏 1
Dustin Getz17:07:15

why is state (mbx) needed? or is that just repl machinery for the example


it is an example, it would work with any flow