Fork me on GitHub

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?


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


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


well you just wrote the code in that line


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


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"


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


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


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