Proposal: Add zip_longest
Julia's Base have an often-used zip function, which terminates as soon as any of the iterators are finished. Stopping when any of the iterators is finished, is one of the two natural stopping conditions, with the other being stopping when all the iterators are finished, and the finished iterators producing a sentinel value until this happens.
I propose adding this function to IterTools.jl, perhaps along the lines of:
zip_longest(iters..., default=nothing)
For one or more iterable objects, return an iterable of tuples, where the `i`th tuple
contains the `i`th component of each input iterable if it is not finished, and `default`
otherwise.
This proposed zip_longest is included in the Python base itertools library, which otherwise contain only a few functions, indicating that at least the Python developers agree this iteration function is particularly useful.
I think this is cool. One could even allow default to be a Tuple, so you could assign different defaults for different elements. No idea when I'd use it, but I like it.
julia> println.(zip_longest(["Alice","Bob"], 1:3", default=("Nobody",0)))
("Alice",1)
("Bob",2)
("Nobody",3)
julia> println.(zip_longest(["Alice","Bob","Catheryn"],1:2, default=("Nobody",0)))
("Alice",1)
("Bob",2)
("Catheryn",0)