Expand description
Breadth-first exhaustive zip for repeatable iterators.
Behavior matches the following pseudocode specification:
- Initialize a counter
iat zero. - When propmted, pull the first element from each iterator.
- If any iterator is empty, return
None.
- If any iterator is empty, return
- When prompted again, advance only the last iterator.
- Continue to do so until the last iterator terminates or reaches its
ith element.- When it does so, reset it and pull the next element from the second-to-last iterator.
- Repeat this process until we exhaust the first iterator.
- When you’ve done that, increase
iand repeat.
- When you’ve done that, increase
- Once
iexceeds the longest iterator’s length, we’re done: returnNone.
Structs§
- Base
Case - End of a recursive implementation of a breadth-first exhaustive
zip. - Breadth
First Manager - Helper struct for a breadth-first zip: a counter controlling the maximum index sum of the internal recursive implementation.
- Breadth
First Zipped - Recursive implementation of a breadth-first exhaustive
zip.
Traits§
- Breadth
First - Helper trait returning a nested list that will be turned into a flat list for a huge but finite range of tuple sizes.
- Breadth
First Zip - Zip a tuple into a lazy breadth-first traversal of each possible combination with a monotonically increasing sum of indices.
- Flatten
- Flatten a nested tuple like
(A, (B, (C, ())))to a flat one like(A, B, C)