Copyright | Copyright (C) 2021 Yoo Chung |
---|---|
License | GPL-3.0-or-later |
Maintainer | dev@chungyc.org |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Some solutions to Problems.P13 of Ninety-Nine Haskell Problems.
Synopsis
- encodeDirect :: Eq a => [a] -> [Encoding a]
Documentation
encodeDirect :: Eq a => [a] -> [Encoding a] Source #
Implement the so-called run-length encoding data compression method directly.
I.e., do not explicitly create the sublists containing the duplicates,
as with pack
, but only count them.
As with encodeModified
,
simplify the result list by replacing the singletons (
by Multiple
1 x)(
.Single
x)