lnicola
6/26/2014 - 12:10 PM

parts.hs

module Main where

parts n = parts' 1 n where
    parts' _ 0 = [[]]
    parts' p n = concatMap (\x -> (map . (:)) x $ parts' x $ n - x) [p .. n]