Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Sieve a = Sieve {}
- (@@) :: Int -> Int -> Sieve Bool
- not' :: Applicative f => f Bool -> f Bool
- (#||#) :: Applicative f => f Bool -> f Bool -> f Bool
- (#&&#) :: Applicative f => f Bool -> f Bool -> f Bool
- (#^^#) :: Applicative f => f Bool -> f Bool -> f Bool
- sieveToList :: Int -> Sieve a -> [a]
- sieveToString :: Int -> Sieve Bool -> [Char]
- sieveToInts :: Int -> Sieve Bool -> [Int]
- sieveToPat :: Int -> Sieve Bool -> Pattern String
- stepSieve :: Int -> String -> Sieve Bool -> Pattern String
- slowstepSieve :: Pattern Time -> Int -> String -> Sieve Bool -> Pattern String
- scaleSieve :: Int -> Sieve Bool -> Pattern Int -> Pattern Int
Documentation
(@@) :: Int -> Int -> Sieve Bool infixl 9 Source #
The basic notation for and constructor of a boolean Sieve
is m@@n
,
which represents all integers whose modulo with m
is equal to n
(#^^#) :: Applicative f => f Bool -> f Bool -> f Bool infixl 2 Source #
#^^#
gives the exclusive disjunction (logical XOR) of two sieves
sieveToList :: Int -> Sieve a -> [a] Source #
sieveToList n
returns a list of the values of the sieve for each
nonnegative integer less than n
For example: sieveToList 10 $ 3@@1
returns
`[False, True, False, False, True, False, False, True, False, False]`
sieveToString :: Int -> Sieve Bool -> [Char] Source #
sieveToString n
represents the sieve as a character string, where
-
represents False and x
represents True
sieveToInts :: Int -> Sieve Bool -> [Int] Source #
sieveToInts n
returns a list of nonnegative integers less than n
where the sieve is True
sieveToPat :: Int -> Sieve Bool -> Pattern String Source #
sieveToPat n
returns a pattern where the cycle is divided into n
beats, and there is an event whenever the matching beat number is in the
sieve
For example: sieveToPat 8 $ 3@@1
returns "~ x ~ ~ x ~ ~ x"
stepSieve :: Int -> String -> Sieve Bool -> Pattern String Source #
stepSieve n str
works like sieveToPat
but uses str
in the pattern
instead of x
slowstepSieve :: Pattern Time -> Int -> String -> Sieve Bool -> Pattern String Source #
slowstepSieve t
is shorthand for applying slow t
to the result of
stepSieve
scaleSieve :: Int -> Sieve Bool -> Pattern Int -> Pattern Int Source #
scaleSieve n
uses sieveToInts
to turn a sieve into a list of
integers, and then uses that with the toScale
function to
turn a pattern of numbers into a pattern of notes in the scale.
For example: scaleSieve 8 (3@@1) "0 1 2 1"
first converts the sieve
to the scale [1, 4, 7]
and then uses that with toScale
to return the
pattern "1 4 7 4"