day 3: small tweak

This commit is contained in:
shu 2019-12-03 16:10:48 +01:00
parent 0e03545e94
commit 6ef036e2c5

View File

@ -14,7 +14,7 @@ parse :: String -> [[(Char,Int)]]
parse = map (map (\x->(head x,read $ tail x))) . map (splitOn ",") . lines
gensteps :: [(Char,Int)] -> [V2 Int]
gensteps = scanl (+) (V2 0 0) . concatMap (\(x,y)->replicate y $ step x)
gensteps = scanl1 (+) . concatMap (\(x,y)->replicate y $ step x)
step :: Char -> V2 Int
step x