diff options
Diffstat (limited to 'h27.hs')
-rw-r--r-- | h27.hs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -0,0 +1,8 @@ +combination :: Int -> [a] -> [[a]] +combination 0 _ = [[]] +combination _ [] = [] +combination c (x:xs) = (map (x:) (combination (c-1) xs)) ++ (combination c xs) + +group :: [Int] -> [a] -> [a] +group [] xs = [[xs]] +group (n:ns) xs = map ((combination n) . head) group (n:ns) xs |