def powerset(seq): Returns all the subsets of this set.generator. if len(seq) <= 1: yield [] for item in powerset例如,
powerset([1,2,3])=>[1, 2, 3][2, 3][1, 3][3][1, 2][2]
我刚刚开始学习Haskell,解决这个问题时遇到了困难:powerSet :: Set a -> Set (Set a)powerSet :: Tree a -> Tree (Treea)powerSet tree = fromList' [fromList' p | p <- powerSet' (toList tree)]
p