aboutsummaryrefslogtreecommitdiffstats
path: root/day16/main.hs
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2021-12-20 14:53:14 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2021-12-20 14:53:14 +0200
commit8cf112cad7c0a52676a834ec3ac77f3006031c87 (patch)
tree2c8aba70caa310f7c00ebe1a5eef739bbc3fe980 /day16/main.hs
parent47a2c42249aab79dd2aec4554d3387d2b47ced21 (diff)
Day 20
Diffstat (limited to 'day16/main.hs')
-rw-r--r--day16/main.hs7
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