diff options
author | Tom Smeding <tom@tomsmeding.com> | 2021-12-01 19:22:21 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2021-12-01 19:22:21 +0100 |
commit | 3dc0370ab576388b7fe6908ac73c4561551a494c (patch) | |
tree | 43276a34370552a7981946587c1f3df8b8f04020 /2021/1.hs | |
parent | 833fcf24d661ef600d00c017ce7796b2fc938a17 (diff) |
2021
Diffstat (limited to '2021/1.hs')
-rw-r--r-- | 2021/1.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/2021/1.hs b/2021/1.hs new file mode 100644 index 0000000..84ae3cb --- /dev/null +++ b/2021/1.hs @@ -0,0 +1,12 @@ +module Main where + +import Data.List + +import Input + + +main :: IO () +main = do + inp <- map read <$> getInput 1 + print (sum . map fromEnum . map (> (0::Int)) $ zipWith (-) (tail inp) inp) + print (sum . map fromEnum . map (> (0::Int)) . (\x -> zipWith (-) (tail x) x) . map sum . filter ((== 3) . length) . map (take 3) $ tails inp) |