RosettaCodeData/Task/Combinations/Haskell/combinations-1.hs
2023-07-01 13:44:08 -04:00

4 lines
122 B
Haskell

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