RosettaCodeData/Task/Combinations/Haskell/combinations-2.hs
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

5 lines
132 B
Haskell

import Data.List (tails)
comb :: Int -> [a] -> [[a]]
comb 0 _ = [[]]
comb m l = [x:ys | x:xs <- tails l, ys <- comb (m-1) xs]