From 8cf112cad7c0a52676a834ec3ac77f3006031c87 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 20 Dec 2021 14:53:14 +0200 Subject: Day 20 --- day16/main.hs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'day16') 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 -- cgit v1.3