This commit is contained in:
pingu 2024-12-03 12:52:47 +01:00
parent e533ce8c6e
commit 9bb30739a2

View File

@ -6,9 +6,9 @@ import Data.List.Split
e :: [String] -> [(Int,Int)] e :: [String] -> [(Int,Int)]
e = ((\case e = ((\case
[a,b] -> (read a, read b) [a,b] -> (read a, read b)
err -> error $ "Parsing failed on: " ++ show err err -> error $ "Parsing failed on: " ++ show err
) . splitWhen (== ',') . init . drop 4 <$>) ) . splitWhen (== ',') . init . drop 4 <$>)
parse1 :: String -> [(Int,Int)] parse1 :: String -> [(Int,Int)]
parse1 = e . getAllTextMatches . (=~ "mul\\([[:digit:]]+,[[:digit:]]+\\)") parse1 = e . getAllTextMatches . (=~ "mul\\([[:digit:]]+,[[:digit:]]+\\)")