Closed maratik123 closed 1 year ago
I think the name combinations_up_to
is nice. What's weird for me is that it starts with "k" items then decrease instead of starting with 0 items then increase, that would feel more natural, something like: vec![], vec![1], vec![2], vec![3], vec![4], vec![1, 2], vec![1, 3], ...
which is not even the reverse order of the current behavior.
Then maybe we could impl DoubleEndedIterator for it (to be able to call .rev()
on it).
EDIT: Currently I think it's something like (0..=k).rev().flat_map(|i| iter.clone().combinations(i))
. Is that needed?
EDIT: Currently I think it's something like
(0..=k).rev().flat_map(|i| iter.clone().combinations(i))
. Is that needed?
Yes, agree with you. Seems that this PR is not needed. Closing it now.
Add combinations_up_to to iterator functions