ninetynine-1.3.0: Ninety-Nine Haskell Problems
CopyrightCopyright (C) 2021 Yoo Chung
LicenseGPL-3.0-or-later
Maintainerdev@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Solutions.P10

Description

Some solutions to Problems.P10 of Ninety-Nine Haskell Problems.

Synopsis

Documentation

encode :: Eq a => [a] -> [(Int, a)] Source #

Use the pack function to implement the so-called run-length encoding data compression method.

Consecutive duplicates of elements are encoded as tuples (n, e), where n is the number of duplicates of the element e.