Safe Haskell | None |
---|---|
Language | Haskell98 |
Combination functions.
- nk_combinations :: Integral a => a -> a -> a
- combinations :: Integral t => t -> [a] -> [[a]]
Documentation
nk_combinations :: Integral a => a -> a -> a Source
Number of k element combinations of a set of n elements.
(nk_combinations 6 3,nk_combinations 13 3) == (20,286)
combinations :: Integral t => t -> [a] -> [[a]] Source
k element subsets of s.
combinations 3 [1..4] == [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] length (combinations 3 [1..5]) == nk_combinations 5 3