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.P51

Description

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

Synopsis

Documentation

corrupt :: RandomGen g => g -> Int -> [Bool] -> [Bool] Source #

Flip a given number of boolean values in the boolean list randomly.

errorCorrectingEncode :: [Bool] -> [Bool] Source #

Construct an error-correcting encoding of the given Boolean list.

Uses a reptition code of length 3.

errorCorrectingDecode :: [Bool] -> [Bool] Source #

The inverse of errorCorrectingEncode. Recover the original Boolean list from its encoding. There could be an error in the encoding.