mirror of
https://github.com/mx42/adventofcode.git
synced 2026-01-14 13:59:51 +01:00
Add 2015 day 12 part1
This commit is contained in:
21
haskellAoC/src/Y2015/Day12.hs
Normal file
21
haskellAoC/src/Y2015/Day12.hs
Normal file
@@ -0,0 +1,21 @@
|
||||
module Y2015.Day12 (y15day12) where
|
||||
|
||||
import Data.Char
|
||||
|
||||
-- getToNext :: Char -> String -> String
|
||||
-- getToNext _ [] = []
|
||||
-- getToNext c (x:xs)
|
||||
-- | x == c = []
|
||||
-- | otherwise = x:(getToNext c xs)
|
||||
|
||||
getStructureSum :: String -> Int
|
||||
getStructureSum s = sum $ map read $ words $ map keepNum s
|
||||
where keepNum '-' = '-'
|
||||
keepNum c
|
||||
| isDigit c = c
|
||||
| otherwise = ' '
|
||||
|
||||
y15day12 :: [String] -> (String, String)
|
||||
y15day12 (input:_) = (part1, part2)
|
||||
where part1 = show $ getStructureSum input
|
||||
part2 = show $ "WIP"
|
||||
Reference in New Issue
Block a user