Partitioning API inconsistencies

I don’t understand why the partitioning methods added by Swift Algorithms accept a subrange to operate on. The standard library’s partition method does not, and SubSequences can be used to accomplish the same thing.

Moreover, it seems to currently be used for distinguishing between unstable and half-stable partition. I think this is a terrible API design: half-stable partition should be named halfStablePartition. I spent ages thinking that a half-stable partition didn’t even exist in the package!

Finally, the documentation uses an incorrect parameter name, isSuffixElement, instead of belongsInSecondPartition.

I think these issues should be resolved immediately. The subrange parameters and ambiguous half-stable partition should be deprecated in the next minor version, and the documentation should be fixed in the next patch version.

1 Like