-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Powerset
count
#735
Powerset
count
#735
Conversation
`Powerset::count` will need both `n` and the count of combinations.
It will be used two other times making this function useful.
I replaced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Philippe-Cholet, thanks for this. I really appreciate the small changes.
I think the computations are correct, although non-tivial. And in some cases I wondered if powerset.count/size_hint
could more clearly delegate to combinations.count/size_hint
, but so far I cannot point my finger exactly where that could easily be achieved.
However, please add some tests that also test combinations for iterators with unreliable size hints (as it stands, the underlying iterator's in the tests seem to have exact size_hints, so maybe use a filtered one).
Tomorrow, I'll add tests with |
I can do a similar test for powerset if you want but I'm gonna wait for your feedback first. |
Thank you a lot! bors r+ As for the new tests: I’m not sure if they too closely reimplement the internal logic and assert that the reimplementation matches the original. I will have a closer look later. I think what I’d test is that the size hints do not become only more exact over time and that they are consistent with count. |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page.
|
@phimuemue After counting combinations last week, I thought a simple PR would be nice to start the week.
The first three commits are about
Powerset::count
while the next four commits are aboutPowerset::size_hint
.