missionary 2025-11-14

I'm scratching my head trying to figure out a version of https://clojurians.slack.com/archives/CL85MBPEF/p1711763822414789?thread_ts=1711754747.466749&cid=CL85MBPEF that works when you want to merge a list of flows. (I guess I could probably solve it in my particular case with a macro, but I'd rather not.)

@leonoel do you think there is a way to work around this? My goal would be to capture the final value from each child branch.

I don't have a workaround, sorry

How bad do you need this ? I have to choose between the quick fix and the right fix

Hm, medium-bad I think? It is blocking a key branch of work on a project that I'm spending most of my time on currently, but I can shift tasks to something else, or maybe I can come up with a different way to frame my solution.

Also like this is open source, I would never expect a maintainer to go out of their way to unblock me

Though of course I would be immensely grateful for any effort you do make

I can make a gist for you to give more context if that would be helpful

as a library author I do benefit from users succeeding with the library

hahaha fair enough ❤️

Nvm, it's simple:

(defn merge-flows [& flows]
  (m/ap (m/?> (m/?> (count flows) (m/seed flows)))))

Whoa, is this expected?

(defn with-final
  []
  (m/ap
   (m/amb=
    :start
    (try
      (m/? m/never)
      (catch missionary.Cancelled _ :end)))))

(defn merge-flows [& flows]
  (m/ap
   (m/?<
    (m/?> (count flows) (m/seed flows)))))

(comment
  (def cancel
    ((m/reduce prn nil (merge-flows (with-final)
                                    (with-final))) prn prn))

  (cancel) ;; prints end once
  (cancel) ;; prints end again!
   )