Taking your questions in reverse!
- For the name, I agree that
partitionMap
is a better match with the behavior of other algorithms. "split" is in a family (with "chunked" and "windows") of methods that divide a collection into subsequences but otherwise maintain their order, with split dropping the separator element(s). This new method is a partition with an added map step baked in for ergonomic reasons.
- The
Comparable
conformance is there so thatEither
can be used as an index for theEitherSequence
type. Rather than designing a properEither
addition to the Algorithms package (it should also beHashable
,Sendable
, etc… should it conform toError
?), we can just add a single-purpose enum for this, named something likePartitionMapResult
with afirst
andsecond
case that will map to the position in the resulting tuple. I think that would be a better strategy for this limited purpose.
- A PR would be welcome!