-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.fs
35 lines (29 loc) · 868 Bytes
/
Program.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
open System
open System.Diagnostics
open System.IO
open Day25
let day = "25"
let inline display partNo (result, time: TimeSpan) =
let timePart = time.TotalSeconds.ToString("000.000000")
printfn $"[{timePart}] Part {partNo}: {result}"
let time action =
let sw = Stopwatch()
sw.Start()
let rslt = action ()
sw.Stop()
(rslt, sw.Elapsed)
let getLines day file =
Path.Combine("../../../input/2023", $"day{day}", $"{file}.txt")
|> File.ReadAllLines
|> List.ofArray
[<EntryPoint>]
let main _ =
if false then
printfn ""
printfn $"Warming up ... "
(fun () -> part1 (getLines day)) |> time |> ignore
(fun () -> part2 (getLines day)) |> time |> ignore
printfn ""
(fun () -> part1 (getLines day)) |> time |> (display 1)
(fun () -> part2 (getLines day)) |> time |> (display 2)
0