-
Notifications
You must be signed in to change notification settings - Fork 442
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
All permutations #56
All permutations #56
Conversation
4b5269d
to
5dcea2c
Compare
@mdznr Oh I see this is still a draft, let us know when you're ready for us to review it! |
I unfortunately haven’t had a lot of time to work on this. The change is very nearly done. It works. The only things left for me was to ensure it was as well-written as it could be, the implementation consistent with |
5dcea2c
to
422beb8
Compare
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.
Thanks a lot for your contribution, @mdznr! This looks very solid, I just have one remark. Feel free to make any other changes you still want to make, but I'm down to get this merged in its current state (modulo that remark).
Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>
55a8994
to
0d05042
Compare
Description
This addition adds the ability to easily get permutations of a range of sizes, instead of the previous behavior of a single, fixed size,
k
, like #51 did forCombinations
.Detailed Design
The
permutations(ofCount:)
function that takes aRangeExpression
is added in an extension ofCollection
.If the upper bound of the range exceeds the length of the collection, no such permutations of those sizes will be returned, effectively clamping the range to
0...n
wheren
is the length of the collection.Naming
The name
permutations(ofCount:)
is the same as the original, but reflects the ability to provide multiple counts. This is the same pattern used forCombinations
.Documentation Plan
The documentation in
Guides/Permutations.md
has been updated to reflect the new function. Inline code documentation also exists for each of the functions.Test Plan
Source Impact
The functionality is purely additive. The behavior of the existing function is unchanged.
Checklist