-
-
Notifications
You must be signed in to change notification settings - Fork 401
Open
Description
I don't see anything in the API to support partitioning a finite collection. Did I miss something? If not, would there be interest in having such a generation strategy? Something along the lines of...
object Gen:
...
def partition[A](n: Int, elems: Set[A]): List[Set[A]]
object Genthen satisfying
a) nonoverlapping: sub1 & sub2 === Set.empty[A] for all (sub1, sub2) in the result, and
b) covering: result.foldLeft(Set.empty[A])(_ |+| _) === elems
While this could be made strict w.r.t. input size (e.g., require(n <= elems.size), since the element type in the output collection would be Set rather than a nonempty set, I think it would make sense to allow empty elements in the output collection if this would be implemented.
Metadata
Metadata
Assignees
Labels
No labels