combinat-0.2.4.1: Generation of various combinatorial objects.

Math.Combinat.Compositions

Description

Compositions. This module is equivalent to the module Combinations, but it turns out that "compositions" is the accepted name. I will remove the Combinations module in the future.

Synopsis

Documentation

compositions'Source

Arguments

:: [Int]

shape

-> Int

sum

-> [[Int]] 

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

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

All compositions fitting into a given shape.

compositionsSource

Arguments

:: Integral a 
=> a

length

-> a

sum

-> [[Int]] 

Compositions of a given length.

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

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

compositions1Source

Arguments

:: Integral a 
=> a

length

-> a

sum

-> [[Int]] 

Positive compositions of a given length.