RosettaCodeData/Task/Combinations/Haskell/combinations-1.hs

5 lines
122 B
Haskell

comb :: Int -> [a] -> [[a]]
comb 0 _ = [[]]
comb _ [] = []
comb m (x:xs) = map (x:) (comb (m-1) xs) ++ comb m xs