Combinations: Difference between revisions

Line 1,029:
comb :: Int -> [a] -> [[a]]
comb 0 _ = [[]]
comb m l = concat [map (x:) (comb (m-1) xs)ys | (x:xs) <- tails l, ys <- comb (m-1) xs]</lang>
 
To generate combinations of integers between 0 and ''n-1'', use
Anonymous user