RosettaCodeData/Task/Power-set/Haskell/power-set-3.hs

3 lines
79 B
Haskell
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
powerSet :: [a] -> [[a]]
powerSet = foldr (\x acc -> acc ++ map (x:) acc) [[]]