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
timvermeulen
left a comment
There was a problem hiding this comment.
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 aRangeExpressionis 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...nwherenis 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.mdhas 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