Synopsis:
subsets s -- yields a list of the subsets of the list s.
The subsets are returned as lists whose elements are in the same order.
i1 : subsets {1,2,3} |
See also:
Code:
-- ../../../Macaulay2/m2/combinatorics.m2:19-25 subsets List := x -> ( if #x === 0 then {x} else ( a := x#-1; x = drop(x,-1); s := subsets x; join(s,apply(s,y->append(y,a)))))