Skip to content

Commit 82227df

Browse files
committed
scaffolding for 2021
1 parent 304b14e commit 82227df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2039
-1
lines changed

Diff for: Main.hs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module Main where
2+
3+
import Y2021.Day1
4+
5+
defaultYear = 2021
6+
7+
solutions = [
8+
(2021, 1) -> (Y2021.Day1.solve1, Y2021.Day1.solve2)
9+
]
10+
11+
main = do
12+
args <- getArgs
13+
yearAndDay@(y, d) <- case args of
14+
[y, d] -> return (y, d)
15+
[d] -> return (defaultYear, d)
16+
_ -> error "Provide one (day) or two (year, day) arguments"
17+
let Just (s1, s2) = lookup solutions yearAndDay
18+
input <- readFile $ "Y" ++ (show y) ++ "/input/day-" ++ show d ++ ".txt"
19+
print (s1 input)
20+
print (s2 input)
21+

Diff for: README.md

+7-1

Diff for: 2020/day-1.hs renamed to Y2020/day-1.hs

File renamed without changes.

Diff for: 2020/day-10.hs renamed to Y2020/day-10.hs

File renamed without changes.

Diff for: 2020/day-11.hs renamed to Y2020/day-11.hs

File renamed without changes.

Diff for: 2020/day-12.hs renamed to Y2020/day-12.hs

File renamed without changes.

Diff for: 2020/day-13.hs renamed to Y2020/day-13.hs

File renamed without changes.

Diff for: 2020/day-14.hs renamed to Y2020/day-14.hs

File renamed without changes.

Diff for: 2020/day-15.hs renamed to Y2020/day-15.hs

File renamed without changes.

Diff for: 2020/day-17.hs renamed to Y2020/day-17.hs

File renamed without changes.

Diff for: 2020/day-18.hs renamed to Y2020/day-18.hs

File renamed without changes.

Diff for: 2020/day-19.hs renamed to Y2020/day-19.hs

File renamed without changes.

Diff for: 2020/day-2.hs renamed to Y2020/day-2.hs

File renamed without changes.

Diff for: 2020/day-3.hs renamed to Y2020/day-3.hs

File renamed without changes.

Diff for: 2020/day-4.hs renamed to Y2020/day-4.hs

File renamed without changes.

Diff for: 2020/day-5.hs renamed to Y2020/day-5.hs

File renamed without changes.

Diff for: 2020/day-6.hs renamed to Y2020/day-6.hs

File renamed without changes.

Diff for: 2020/day-7.hs renamed to Y2020/day-7.hs

File renamed without changes.

Diff for: 2020/day-8.hs renamed to Y2020/day-8.hs

File renamed without changes.

Diff for: 2020/day-9.hs renamed to Y2020/day-9.hs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: Y2021/Day1.hs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{-# language BangPatterns #-}
2+
module Day1 (solve1, solve2)
3+
4+
solve1 :: String -> IO ()
5+
solve1 = undefined
6+
7+
countInc :: [Int] -> Int
8+
countInc xs = foldl1' (((x, x'), !s) -> if x < x' then s + 1 else s) (zip xs tail xs)
9+
10+
solve2 = undefined
11+

0 commit comments

Comments
 (0)