Run-length encoding: Difference between revisions
→Haskell :: As a fold
(→Haskell :: As a fold: Slight reduction – pruned out an import.) |
|||
Line 2,930:
encoded = runLengths testString
putStrLn $ showLengths encoded
print $
------------------------- DISPLAY ------------------------
showLengths :: [(Int, Char)] -> String
showLengths [] = []
showLengths ((n, c) : xs) = show n <> [c] <> showLengths xs</lang>
{{Out}}
<pre>12W1B12W3B24W1B14W
|