TupleCombinations: size_hint and count#763
Merged
jswrenn merged 6 commits intoSep 28, 2023
Merged
Conversation
`TupleCombinations` and `Tuple1Combination` merely wrap an iterator so I just call its `size_hint` method. `Tuple2Combination` chains a wrapped `Tuple1Combination` with a smaller `Tuple2Combination` but this one is not initialized yet so it is full and therefore has `binomial(n, k)` elements. Similar for `3..=12`, it's just recursive.
Same as `TupleCombinations::size_hint` but simpler.
Member
Author
|
@jswrenn Ooops... I missed that |
Member
|
Yes, in adaptors/mod.rs is fine. |
Just cut/paste, and fixed imports. It is moved because it is now needed even without heap-allocation.
jswrenn
requested changes
Sep 28, 2023
Member
jswrenn
left a comment
There was a problem hiding this comment.
For consistency, could you add a specialization test for this to tests/specializations.rs?
jswrenn
approved these changes
Sep 28, 2023
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was definitely simpler to implement than it was for
Combinations(with vector items). The only difficulty is that it's recursive with a macro.According to my notes, all iterators that should have a
size_hintspecialization now have. I like that.The
count_identmacro is moved to be available library-wide.