Closed leonoel closed 3 years ago
Can you elaborate what pattern would substitute gather
's usage? I'm working on the RxJava comparison tutorial and the next example merges two Observable
s, which seems what gather
does. After thinking for 10 minutes and sifting through the API I haven't found another way to merge 2 flows.
Nevermind, I see gather is implemented as
([f & fs] (ap (?? (?= (enumerate (cons f fs))))))
Now just to understand that :)
enumerate
turns a list of flows into a flow of flows. ?=
forks the flow of flows into flows running concurrently. ??
picks the next value in each forked process. Not bad.
With amb=
this would be (ap (?? (amb= f1 f2 f3 ...)))
, right?
deprecated b.19
(defn mix [& flows] (m/ap (m/?> (m/?> (count flows) (m/seed flows)))))
Leo says: "I want to minimize the surface API and encourage usage of primitive operators instead. If this operator exists then a dozen other combinations deserve to exist too"
gather
was useful beforeap
/?=
was a thing, much less now, especially consideringamb=
.