JuliaCollections / IterTools.jl

Common functional iterator patterns
Other
152 stars 28 forks source link

Alternate #81

Open gustaphe opened 3 years ago

gustaphe commented 3 years ago

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
oxinabox commented 1 year ago

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

gustaphe commented 1 year ago

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)