partition of a set or all possible subgroups of a list
Let's say I have a list of [1,2,3,4] I want to produce all subsets of this set which covers all members once, the result should has 15 lists which the order isn't important, instead t provides all possible subgroups: >>>>[[1,2,3,4]] [[1][2][3][4]] [[1,2],[3][4]] [[1,2],[3,4]] [[1][2],[3,4]] [[1,3],[2][4]] [[1,3],[2,4]] [[1][3],[2,4]] [[1],[2,3][4]] [[1,4],[2,3]] [[1][2,3,4]] [[2][1,3,4]] [[3][1,2,4]] [[4][1,2,3]] This is a set partitioning problem or partitions of a set which is discussed here , but the response made me confused as it just suggests recalling permutations, but I don't know how!