adventofcode-0.1.0.0: Haskell solutions to adventofcode
LicenseMIT
Maintainer@tylerjl
Safe HaskellSafe-Inferred
LanguageHaskell2010

Y2021.D03

Description

Solutions to the 2021 day 03 set of problems for adventofcode.com.

Synopsis

Documentation

type Bit = Int #

For clearer function signatures.

type Bits = [Bit] #

Also, for clearer function signatures.

part3A :: Text -> Float #

Accept a list of bits and multiply the common indexes.

part3B :: Text -> Float #

Accept a list of bits and multiply the matching value with the matching common and least-common bits, respectively.

keepAt :: [Bits] -> Bit -> Int -> [Bits] #

Keep bit arrays that have a particular bit set at a particular index.

bitsToDec :: Bits -> Float #

Convert a bit array to a decimal value.

commonOn :: Ord b => (Int -> b) -> [Bits] -> Bits #

Big fugly function to take a list of bits and return the common bit set in each position.

toBits :: Text -> [Bits] #

Input parser to accept newline-separated bits

toBit :: Char -> Int #

Fail-fast char-to-int parser.