You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current implementation makes it hard to iterate over all combinations of infinite iterator.
E.g. every element from (1..).combinations(3) will always start with [1,2,...] so there is no way to ever get [2,3,4].
But there is another way to implement this:
Iterate over all combinations which uses only indices < n (in lexicographic order).
Iterate over the rest.
This way our example will be [1,2,3], [1,2,4], [1,3,4], [2,3,4], [1,2,5], ...
It is practical to also have this implementation alongside with current.
I can make a PR.
Current implementation makes it hard to iterate over all combinations of infinite iterator.
E.g. every element from
(1..).combinations(3)
will always start with[1,2,...]
so there is no way to ever get[2,3,4]
.But there is another way to implement this:
This way our example will be
[1,2,3], [1,2,4], [1,3,4], [2,3,4], [1,2,5], ...
It is practical to also have this implementation alongside with current.
I can make a PR.
EDIT: This is similar to #293 (but not the same).
The text was updated successfully, but these errors were encountered: