~jaro/balkon

ref: 0b2a78cbf854bd0ef02be2ee5cd1aa65315eab1a balkon/test/Data/Text/ParagraphLayout/RunLengthEncoding.hs -rw-r--r-- 326 bytes
0b2a78cbJaro Test spanToRuns independently for scripts/directions. 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
8
module Data.Text.ParagraphLayout.RunLengthEncoding (runLengthDecode) where

-- | Decode a run-length encoded list.
--
-- Helpful for concisely representing lists with many repeated values.
runLengthDecode :: [(Int, a)] -> [a]
runLengthDecode [] = []
runLengthDecode ((len, val) : xs) = replicate len val ++ runLengthDecode xs