Safe Haskell | None |
---|

Compositions.

See eg. http://en.wikipedia.org/wiki/Composition_%28combinatorics%29

- type Composition = [Int]
- compositions' :: [Int] -> Int -> [[Int]]
- countCompositions' :: [Int] -> Int -> Integer
- allCompositions1 :: Int -> [[Composition]]
- allCompositions' :: [Int] -> [[Composition]]
- compositions :: Integral a => a -> a -> [[Int]]
- countCompositions :: Integral a => a -> a -> Integer
- compositions1 :: Integral a => a -> a -> [[Int]]
- countCompositions1 :: Integral a => a -> a -> Integer

# Documentation

type Composition = [Int]Source

Compositions fitting into a given shape and having a given degree. The order is lexicographic, that is,

sort cs == cs where cs = compositions' shape k

countCompositions' :: [Int] -> Int -> IntegerSource

allCompositions1 :: Int -> [[Composition]]Source

All positive compositions of a given number (filtrated by the length).
Total number of these is `2^(n-1)`

allCompositions' :: [Int] -> [[Composition]]Source

All compositions fitting into a given shape.

countCompositions :: Integral a => a -> a -> IntegerSource

# = \binom { len+d-1 } { len-1 }

Positive compositions of a given length.

countCompositions1 :: Integral a => a -> a -> IntegerSource