CreatingRhythms-1.8.0.7
Copyright(c) Eric Bailey 2025
LicenseMIT
Maintainereric@ericb.me
Stabilitystable
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Rhythm.Binary.Christoffel

Description

Binary Christoffel words.

Synopsis

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]