open System.IO\r
\r
let day01 () =\r
- let input = File.ReadAllText "Data/day01.input" |> Day01.parseInput\r
- input\r
+ let changes = File.ReadAllText "Data/day01.input" |> Day01.parseInput\r
+ sprintf "part1 = %A, part2 = %A" (Day01.finalFrequency changes) (Day01.firstDuplicate changes)\r
+ \r
+ let day02 () =\r
+ let ids = File.ReadAllText "Data/day02.input" |> Day02.parseInput\r
+ let idLength = ids.[0].Length\r
+ sprintf "part1 = %A, part2 = %A" (Day02.checksum ids) (Day02.findTwoStingsWithCommonChars ids (idLength - 1))\r
+ \r
+ let day03 () =\r
+ let claims = File.ReadAllText "Data/day03.input" |> Day03.parseInput\r
+ let surface, claimId = Day03.overlappingSurface claims\r
+ sprintf "part1 = %A, part2 = %A" surface claimId\r
\r
-let days : (unit -> string) array =\r
- [|\r
- day01\r
- day02\r
- day03\r
- |]\r
+let days : Map<int, unit -> string> =\r
+ [\r
+ 1, day01\r
++ 2, day02\r
++ 3, day03\r
+ ] |> Map.ofList\r
\r
let doDay (n : int) =\r
if n < 1 then\r