| Copyright | Copyright (C) 2021 Yoo Chung |
|---|---|
| License | GPL-3.0-or-later |
| Maintainer | dev@chungyc.org |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Solutions.P12
Description
Some solutions to Problems.P12 of Ninety-Nine Haskell Problems.
Synopsis
- decodeModified :: [Encoding a] -> [a]
- decodeModified' :: [Encoding a] -> [a]
Documentation
decodeModified :: [Encoding a] -> [a] Source #
Given a run-length code list generated by encodeModified,
construct its uncompressed version.
Duplicates each element as appropriate and concatenates them together.
decodeModified' :: [Encoding a] -> [a] Source #
Given a run-length code list generated by encodeModified,
construct its uncompressed version.
Prepend each element as many times as required, starting from the last element prepended to an empty list, and all the way to the first element.