partition :: Integer -> Integer -> [[Integer]]
partition total 1 = [[total]]
partition total numparts =
concat $ map (prepend) [total, (total - 1) .. 0]
where
prepend x = map (x:) (subpart x)
subpart x = partition (total - x) (numparts - 1)
-- then:
partition 100 5
####
partition :: Integer -> Integer -> [[Integer]]
partition total 1 = [[total]]
partition total numparts =
concat $ map (prepend) numlist
where
prepend x = map (x:) (subpart x)
subpart x = partition (total - x) (numparts - 1)
numlist = filter twoorfive [total, (total - 1) .. 0]
twoorfive x = x `mod` 2 == 0 || x `mod` 5 == 0
##
##
allLists :: Integer -> Integer -> [[Integer]]
allLists n len = ?