X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=adventofcode1702%2Fapp%2Fadvent02.hs;fp=adventofcode1702%2Fapp%2Fadvent02.hs;h=0000000000000000000000000000000000000000;hb=0d01bb3582b4b7f5ee86ff37a8136161c5c061c3;hp=c7a43483f8a025680d1cda17fdd2a1b3460655a0;hpb=89bf7fd456e520c5483fa138b5a49f07f2703df4;p=advent-of-code-17.git

diff --git a/adventofcode1702/app/advent02.hs b/adventofcode1702/app/advent02.hs
deleted file mode 100644
index c7a4348..0000000
--- a/adventofcode1702/app/advent02.hs
+++ /dev/null
@@ -1,44 +0,0 @@
-module Main(main) where
-
-import Text.Parsec 
-import Text.ParserCombinators.Parsec.Number
-
-
-main :: IO ()
-main = do 
-        text <- readFile "data/advent02.txt"
-        let sheet = successfulParse $ parseFile text
-        print $ part1 sheet
-        print $ part2 sheet
-
-
-part1 :: [[Int]] -> Int
-part1 = sum . map p1cSum
-
-part2 :: [[Int]] -> Int
-part2 = sum . map p2cSum
-
-
-p1cSum :: [Int] -> Int
-p1cSum row = (maximum row) - (minimum row)
-
-p2cSum :: [Int] -> Int
-p2cSum digits = sum [a `div` b | a <- digits, b <- digits, a /= b, a `mod` b == 0]
-
-
-
-sFile = sLine `sepEndBy` newline 
-sLine = int `sepBy` onlySpaces
-
-onlySpaces = many (oneOf " \t")
-
-parseFile :: String -> Either ParseError [[Int]]
-parseFile input = parse sFile "(unknown)" input
-
-parseLine :: String -> Either ParseError [Int]
-parseLine input = parse sLine "(unknown)" input
-
-successfulParse :: Either ParseError [a] -> [a]
-successfulParse (Left _) = []
-successfulParse (Right a) = a
-