diff options
Diffstat (limited to 'day16/main.hs')
| -rw-r--r-- | day16/main.hs | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/day16/main.hs b/day16/main.hs index 56510ae..1f1f8ca 100644 --- a/day16/main.hs +++ b/day16/main.hs @@ -32,13 +32,6 @@ convertHex other = error $ "invalid hex: " ++ [other] hexToBinaryString "" = "" hexToBinaryString (hex : rest) = convertHex hex ++ hexToBinaryString rest --- | Convert binary (list of zeros and ones) to decimal -binaryToInt :: String -> Int -binaryToInt = reverse .> binaryToInt' - -binaryToInt' [] = 0 -binaryToInt' (x : xs) = digitToInt x + 2 * binaryToInt' xs - applyOperator opTypeId subValues = case opTypeId of 0 -> sum subValues 1 -> product subValues |
