// Set partitions of a given shape setPartitionsLambda:=function(n,lambda) G:=Sym(n); x:={ Seqset(y) : y in Partition([1..n],lambda) }; return Setseq(Orbit(G,x)); end function; // Set partitions of all shapes setPartitions:=func< n | &cat[ setPartitionsLambda(n,l) : l in Partitions(n) ] >; // Example setPartitions(3);