fun insertAll(a,nil) = nil | insertAll(a,L::Ls) = (a::L)::insertAll(a,Ls); fun powerSet(nil) = [nil] | powerSet(x::xs) = let val L = powerSet(xs) in L @ insertAll(x,L) end;