hmt-0.20: Haskell Music Theory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Duration.Hollos2014

Description

"Creating Rhythms" by Stefan Hollos and J. Richard Hollos http://abrazol.com/books/rhythm1/software.html

Synopsis

Documentation

partm :: (Num a, Ord a) => a -> a -> [[a]] Source #

Donald Knuth, Art of Computer Programming, Algorithm H http://www-cs-faculty.stanford.edu/~knuth/fasc3b.ps.gz

partm 3 6 == [[1,1,4],[2,1,3],[2,2,2]]

part :: (Num a, Ord a, Enum a) => a -> [[a]] Source #

Generates all partitions of n.

compUniq 4 == [[1,1,1,1],[1,1,2],[1,3],[2,2],[4]]
compUniq 5 == [[1,1,1,1,1],[1,1,1,2],[1,1,3],[2,1,2],[1,4],[2,3],[5]]

parta :: (Num a, Ord a, Enum a) => a -> [a] -> [[a]] Source #

Generates all partitions of n with parts in the set e.

parta 8 [2,3] == [[2,2,2,2],[3,2,3]]

comp :: (Num a, Ord a, Enum a) => a -> [[a]] Source #

Generate all compositions of n.

comp 4 == [[1,1,1,1],[1,1,2],[1,2,1],[2,1,1],[1,3],[3,1],[2,2],[4]]
length (comp 8) == 128

compm :: (Ord a, Num a) => a -> a -> [[a]] Source #

Generates all compositions of n into k parts.

compm 3 6 == [[1,1,4],[1,4,1],[4,1,1],[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1],[2,2,2]]
length (compm 5 16) == 1365

compa :: (Num a, Ord a, Enum a) => a -> [a] -> [[a]] Source #

Generates all compositions of n with parts in the set (p1 p2 ... pk).

compa 8 [3,4,5,6] == [[3,5],[5,3],[4,4]]

compam :: (Num a, Ord a, Enum a) => a -> a -> [a] -> [[a]] Source #

Generates all compositions of n with m parts in the set (p1 p2 ... pk).

compam 4 16 [3,4,5]

neck :: (Ord t, Num t) => Int -> [[t]] Source #

Generates all binary necklaces of length n. http://combos.org/necklace

neck 5 == [[1,1,1,1,1],[1,1,1,1,0],[1,1,0,1,0],[1,1,1,0,0],[1,0,1,0,0],[1,1,0,0,0],[1,0,0,0,0],[0,0,0,0,0]]

neckm :: (Num a, Ord a) => Int -> Int -> [[a]] Source #

Generates all binary necklaces of length n with m ones.

neckm 8 2 == [[1,0,0,0,1,0,0,0],[1,0,0,1,0,0,0,0],[1,0,1,0,0,0,0,0],[1,1,0,0,0,0,0,0]]

necklaceParts :: (Eq a, Num a) => [a] -> [Int] Source #

Part is the length of a substring 10...0 composing the necklace. For example the necklace 10100 has parts of size 2 and 3.

necklaceParts [1,0,1,0,0] == [2,3]
necklaceParts [0,0,0,0,0,0,0,0] == []

necklaceWithParts :: (Eq a, Num a) => [Int] -> [a] -> Bool Source #

necka :: (Num a, Ord a) => Int -> [Int] -> [[a]] Source #

Generates all binary necklaces of length n with parts in e.

necka 8 [2,3,4] == [[1,0,1,0,1,0,1,0],[1,0,1,0,0,1,0,0],[1,0,1,0,1,0,0,0],[1,0,0,0,1,0,0,0]]

neckam :: (Num a, Ord a) => Int -> Int -> [Int] -> [[a]] Source #

Generates all binary necklaces of length n with m ones and parts in e.

permi :: [a] -> [[a]] Source #

Generates all permutations of the non-negative integers in the set.

permi [1,2,3] == [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]