Combinations: Difference between revisions

Content deleted Content added
Line 1,029: Line 1,029:
comb :: Int -> [a] -> [[a]]
comb :: Int -> [a] -> [[a]]
comb 0 _ = [[]]
comb 0 _ = [[]]
comb m l = concat [map (x:) (comb (m-1) xs) | (x:xs) <- tails l]</lang>
comb m l = [x:ys | x:xs <- tails l, ys <- comb (m-1) xs]</lang>


To generate combinations of integers between 0 and ''n-1'', use
To generate combinations of integers between 0 and ''n-1'', use