This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Hi all. If I want to make a discreet flow (via m/ap) of successive values say, taken from mailbox, is this the way to go?
(m/ap
(let [_ (m/?> (m/seed (cycle [:i-am-a-dummy-value])))
v (m/? mailbox)]
v))
I haven't found anything simpler than forking on an infinite "helper" flow, and this looks pretty bad to me, as if I am missing some important piece.It is one way, you can reduce it to (m/ap (m/? (m/?> (m/seed (repeat mailbox)))))
Alternatively, you can use amb
in a loop, which is equivalent :
(m/ap
(loop []
(m/amb
(m/? mailbox)
(recur))))
❤️ 2
@U053XQP4S, thanks! Oh wow, that nested (recur) as a parameter to m/amb has caught me off-guard. So, basically, m/amb does not actually "return" multiple values into the generated flow, it "forks" into multiple execution paths, each of which might "generate" values by itself — do I get it right?