News for hackers. Stuff that matters.
Re:In Praise of Haskell by platz on Thursday November 07, 2013 @11:56PM (#6694532)
Here's a recursive definition which is less cool but less 'magic'

    powerset        :: [a] -> [[a]]
    powerset     [] =  [[]]
    powerset (x:xs) =  yss ++ map (x:) yss
                       where yss = powerset xs

    > powerset [1,2,3]
 
    [[],[3],[2],[2,3],[1],[1,3],[1,2],[1,2,3]]

There are no comments on this comment yet.