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 Gen
then 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.
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...
then satisfying
a) nonoverlapping:
sub1 & sub2 === Set.empty[A]for all(sub1, sub2)in the result, andb) covering:
result.foldLeft(Set.empty[A])(_ |+| _) === elemsWhile 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 beSetrather than a nonempty set, I think it would make sense to allow empty elements in the output collection if this would be implemented.