IterTools.jl icon indicating copy to clipboard operation
IterTools.jl copied to clipboard

Alternate

Open gustaphe opened this issue 3 years ago • 2 comments

Adds "Alternate", an iterator that cycles through a number of iterators until one of them runs out.

julia> println(alternate(1:5,"the",-(1:5)));
1
t
-1
2
h
-2
3
e
-3
4

gustaphe avatar Nov 28 '20 20:11 gustaphe

I would like to call this interleave to match interleaveby which we added yesterday. And the microkanren paper

oxinabox avatar Jun 07 '23 01:06 oxinabox

Sounds good to me. I don't have a strong sense of how this was implemented either because it's been a while, so make any changes you want :) (let me know if you need me to do something, I might have some time later this week)

gustaphe avatar Jun 07 '23 05:06 gustaphe