Function malachite_base::unions::exhaustive::exhaustive_union2s
source · pub const fn exhaustive_union2s<X, I: Iterator<Item = X>, Y, J: Iterator<Item = Y>>(
xs: I,
ys: J,
) -> ExhaustiveUnion2s<X, I, Y, J> ⓘ
Expand description
This documentation applies not only to exhaustive_union2s
, but also to
exhaustive_union3s
, exhaustive_union4s
, and so on. See exhaustive_unions
for
more information.
Generates all $n$-unions with elements from $n$ iterators.
The input iterators are advanced in a round-robin fashion. First an element from the
first variant’s iterator is selected, followed by an element from the second variant’s
iterator, and so on until an element has been selected from each iterator. Then another
element from the first iterator is selected, etc. Iterators that have been exhausted are
skipped. exhaustive_union2s
behaves just like
Itertools::interleave
.
If all input iterators are finite, the output length is the sum of the lengths of the iterators. If any iterator is infinite, the output is also infinite.
If all of the input iterators are empty, the output is also empty.
§Examples
See here.