advent-23-clojure/main.clj

31 lines
698 B
Clojure
Raw Normal View History

2024-11-08 22:29:15 +00:00
(ns main
"Advent Of Code 2023 solved in Clojure"
(:require
2024-11-11 16:18:46 +00:00
[day01]
2024-11-11 22:29:41 +00:00
[day02]
[day03])
2024-11-11 16:50:08 +00:00
(:import
[java.time Instant Duration]))
(defn benchmark
[f day part]
(let [then (Instant/now)
result (f)
now (Instant/now)
time (.toMillis (Duration/between then now))]
(println (str "Day " day " part " part ": " result " (" time " ms)"))))
2024-11-08 22:29:15 +00:00
(defn aoc-23 []
(printf "Advent of Code 2023, solved in Clojure.\n\n")
2024-11-11 16:50:08 +00:00
(benchmark day01/part1 "01" "1")
(benchmark day01/part2 "01" "2")
(benchmark day02/part1 "02" "1")
(benchmark day02/part2 "02" "2")
2024-11-11 22:29:41 +00:00
(benchmark day03/part1 "03" "1")
(benchmark day03/part2 "03" "2")
2024-11-11 16:50:08 +00:00
(println "\nthe end."))
2024-11-08 22:29:15 +00:00
(aoc-23)
2024-11-09 03:59:33 +00:00