:
If |S| = 1
Return ∅
Otherwise
For each nonempty proper subset X ⊂ S
Let Y = S - X
Add {X, Y} to R
For each Z in {partitionSet(X)}
Add Z ∪ {Y} to R.
Return R
"" , concatMap . R . Haskell Data.List.subsequences
.
S, , , . , X > Y, {X, Y}, {Y, X} {X, Y, Z}, {Y, X, Z}. , !
S, ⋃Z = X X ∪ Y = S, Z Y S, S, subpartition , .
{X, SX}, , X. i > 2 {a_1, a_2,..., a_i}, {a_1, a_2} - {a_1 ⋃ a_2} {{a_1 ⋃ a_2},..., a_i} - i-1 parent node . S.