mickeelm
04/26/2023, 5:13 PMExhaustive
of partial permutations/k-permutations of a list, so I modified the current permutations(list: List<A>)
implementation a bit, adding k: Int = list.size
as a parameter (where k
cannot be larger than the list size and must be greater than zero). Effectively meaning that if you omit k
, the function will behave just like before, but if you provide k
you'd get permutations of size k
.
Would you be interested in a PR? If so, would you like me to modify the current method (what I've done locally) or perhaps add another method (like partialPermutations()
or equivalent)?Emil Kantis
04/26/2023, 5:26 PM@Deprecated
, add another method with the additional param with a default value and we can replace the deprecated one completely in 6.0 or something 🙂 Imo the name can be kept as permutations
, perhaps k
could be just permutationLength
, length
or something else that's descriptive?
Disclaimer: I work with Mikael (shoving Kotest down his throat all day) 😉mickeelm
04/29/2023, 11:06 AMlength
added, but the original method deprecated. The downside with that is that any calls without an explicit parameter length
, will "point" to the original method and thus get a deprecated-warning (and the only way to get rid of it is to explicitly add a length
-value to every call). Does not feel nice IMO and possibly pretty confusing
2. Break binary compability (add length
to the existing method)
3. Add a new method called partialPermutations
or equivalent
I'll adapt to your wishes but if the breaking part does not seem high risk/impact, I think option 2 is nicest API-wise.