Fork me on GitHub
#missionary
<
2022-07-01
>
martinklepsch11:07:09

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

Dustin Getz13:07:53

Seeking contractor – this work involves using missionary

martinklepsch14:07:13

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?

martinklepsch14:07:29

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.

leonoel20:07:51

(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

leonoel17:07:48

it is an example, it would work with any flow