Copyright | (c) Eric Bailey 2025 |
---|---|
License | MIT |
Maintainer | eric@ericb.me |
Stability | stable |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Data.Rhythm.Binary.Christoffel
Description
Binary Christoffel words.
Ergonomic
christoffelWord :: Bool -> Rational -> Int -> [Integer] Source #
See christoffelWord'
.
>>>
christoffelWord False (3 % 7) 10
[0,0,0,1,0,0,1,0,0,1]
>>>
christoffelWord True (3 % 7) 10
[1,0,0,1,0,0,1,0,0,0]
>>>
christoffelWord True (3 % 7) 20
[1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0]
Safe
christoffelWord' :: forall m n d. (KnownNat m, KnownNat n, KnownNat d) => Bool -> Vector m (Finite 2) Source #
Generate the upper or lower Christoffel word for a given slope with a given number of terms.
>>>
map getFinite $ VS.toList $ christoffelWord' @10 @3 @7 False
[0,0,0,1,0,0,1,0,0,1]
>>>
map getFinite $ VS.toList $ christoffelWord' @10 @3 @7 True
[1,0,0,1,0,0,1,0,0,0]
>>>
map getFinite $ VS.toList $ christoffelWord' @20 @3 @7 True
[1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0]