Fork me on GitHub
#core-async
<
2019-12-05
>
bortef09:12:46

Is there any way in core.async to have something similar to an alts! that take from different channels, but that it will take from all channels available, instead of picking 1 randomly?

bortef10:12:27

Was thinking something that would retrieve all of them on 1 pass

bortef10:12:13

But I think what I am looking would be to iterate all channels with poll! and return a map of the ones with values

alexmiller14:12:02

well you just wrote the code in that line

alexmiller14:12:13

in short, no, but it's pretty easy to write

bortef14:12:33

Problem with map for my use case is that maybe not all channels might have an available value, and that would prevent the others from being taken. I am rethinking how to handle this case, as I think I was approaching it from the wrong perspective for what I need. Thanks for the help!

Filipe Silva14:12:10

uhm.... I think what you want is a map where you apply alts between the element and a timeout

Filipe Silva14:12:49

that'd mean "I want all results available by this timeout"

alexmiller15:12:31

but you'd only get one result, not all available

alexmiller15:12:04

unless you're saying to build a thing that did that

bortef15:12:48

What I was thinkingt was more like an alts that would take all available when more than one are available, but in the end I changed the approach to not need this at all and use common core.async fns