Is there an idiomatic way in core.async
to make a sort of combining stream? Let’s say I have a function (fn [x y] ...
, one channel for x
and another channel for y
. What I’m looking for is a channel that contains the result (f x y)
for every inbound update to either x
or y
.
core.async/map ?
That looks like it would consume x
and y
in pairs, no? (So if an x
arrives with no y
, there’d be no update until it gets a y
too?)
@mike566 have a look at alts!
- if i understand correctly you want to use cached values of x
or y
to correspond to the latest value from whichever channel delivers first, so perhaps cache x
and y
in a go
block and use alts!
to get new values ?
@mccraigmccraig Thanks! I’ll take a look and see. (What you’re saying about using cached values is what I was trying to get at.)