hmt-0.14: Haskell Music Theory

Safe HaskellNone

Music.Theory.Combinations

Description

Combination functions.

Synopsis

Documentation

nk_combinations :: Integral a => a -> a -> aSource

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