Maybe I'm missing some simple answer. Task - we have a set of size n*k, need to get a list of lists (size n) of sets (size k) with all possible combinations for splitting the set into parts of this size.
Sample:
Set:
(1,2,3,4,5,6)
Size: 3
Expected result:
[[(1,2,3),(4,5,6)],
[(1,2,4),(3,5,6)],
[(1,2,5),(3,4,6)],
[(1,2,6),(3,4,5)],
[(1,3,4),(2,5,6)],
[(1,3,5),(2,4,6)],
[(1,3,6),(2,4,5)],
[(1,4,5),(2,3,6)],
[(1,4,6),(2,3,5)],
[(1,5,6),(2,3,4)]]
The only thing that comes to mind is to find all subsets of size k and group them into lists taking only these that contain non-repeating elements.