Power set: Difference between revisions
→{{header|Haskell}}: Fixed mismatch between a function name and its type signature name, added a point-free formulation
(→{{header|Haskell}}: Fixed mismatch between a function name and its type signature name, added a point-free formulation) |
|||
Line 1,438:
or
<lang Haskell>powerSet :: [a] -> [[a]]
which could also be understood, in point-free terms, as:
<lang haskell>powerSet :: [a] -> [[a]]
powerSet = foldr ((mappend <*>) . fmap . (:)) (pure [])</lang>
Examples:
|