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

Data.Rhythm.Binary.BurrowsWheeler

Description

Binary necklaces via the set of Lyndon words generated by an inverse Burrows-Wheeler transform. Modified from Rosetta Code.

Synopsis

Documentation

necklaces :: Int -> [[Int]] Source #

All binary necklaces of a given length.

>>> necklaces 4
[[1,1,1,1],[1,1,1,0],[1,1,0,0],[1,0,1,0],[1,0,0,0],[0,0,0,0]]

lyndonWords :: Ord a => [a] -> Int -> [[a]] Source #

The set of Lyndon words generated by an inverse Burrows-Wheeler transform.

>>> lyndonWords [0,1] 4
[[0],[0,0,0,1],[0,0,1,1],[0,1],[0,1,1,1],[1]]

cycleForm :: [Int] -> [[Int]] Source #

Represent a permutation in a cycle notation.

>>> cycleForm [1,5,4,3,2,0]
[[1,5,0],[4,2],[3]]