Crates.io | breadth-first-zip |
lib.rs | breadth-first-zip |
version | 0.3.0 |
source | src |
created_at | 2023-06-29 19:57:58.784335 |
updated_at | 2023-07-02 09:08:55.82911 |
description | Breadth-first `zip` guaranteeing a monotonically increasing sum of indices. |
homepage | |
repository | https://github.com/wrsturgeon/breadth-first-zip |
max_upload_size | |
id | 903649 |
size | 33,002 |
zip
Property-tested and verified to return every possible value exactly one in a strictly increasing sum of indices.
For whenever you have a multiple iterators and want to cover every possible value from overall smallest to largest.
E.g. for three instances of 0..3
, you'd get this:
0 0 0 # sum = 0
0 0 1 # sum = 1
0 1 0
1 0 0
0 0 2 # sum = 2
0 1 1
0 2 0
1 0 1
1 1 0
2 0 0
0 1 2 # sum = 3
0 2 1
1 0 2
1 1 1
1 2 0
2 0 1
2 1 0
0 2 2 # sum = 4
1 1 2
1 2 1
2 0 2
2 1 1
2 2 0
1 2 2 # sum = 5
2 1 2
2 2 1
2 2 2 # sum = 6
Inputs can be any non-empty iterator, even combining different sizes.