| Copyright | Copyright (C) 2021 Yoo Chung |
|---|---|
| License | GPL-3.0-or-later |
| Maintainer | dev@chungyc.org |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Problems.P11
Description
Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P11.
Synopsis
- encodeModified :: Eq a => [a] -> [Encoding a]
Documentation
encodeModified :: Eq a => [a] -> [Encoding a] Source #
Modify the encode function in such a way that
if an element has no duplicates it is simply copied into the result list.
Only elements with duplicates are transferred as ( values.Multiple n x)
Examples
>>>encodeModified "aaaabccaadeeee"[Multiple 4 'a',Single 'b',Multiple 2 'c',Multiple 2 'a',Single 'd',Multiple 4 'e']