From 138f379a40eea9b42697393224bd878330b56dd3 Mon Sep 17 00:00:00 2001 From: Fernando Araoz Date: Mon, 11 Nov 2024 11:18:46 -0500 Subject: [PATCH] feat: files for day 2 --- main.clj | 8 ++++++-- src/day01.clj | 4 ++-- src/day02.clj | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/day02.clj diff --git a/main.clj b/main.clj index d8cf285..4bf0ce9 100644 --- a/main.clj +++ b/main.clj @@ -1,12 +1,16 @@ (ns main "Advent Of Code 2023 solved in Clojure" (:require - [day01])) + [day01] + [day02])) (defn aoc-23 [] (printf "Advent of Code 2023, solved in Clojure.\n\n") (println (str "Day 01 part 1: " (day01/part1))) - (println (str "Day 01 part 2: " (day01/part2)))) + (println (str "Day 01 part 2: " (day01/part2))) + (println (str "Day 02 part 1: " (day02/part1))) + (println (str "Day 02 part 2: " (day02/part2))) + (println "the end.")) (aoc-23) diff --git a/src/day01.clj b/src/day01.clj index 1b18548..ae0acc7 100644 --- a/src/day01.clj +++ b/src/day01.clj @@ -24,7 +24,7 @@ (def contents (utils/read-file "01" false)) ; Vector of String -(def lines "Vector of String" (clojure.string/split-lines contents)) +(def lines ":: Vector of String" (clojure.string/split-lines contents)) ; Char -> Bool (defn is-digit? [c] @@ -74,7 +74,7 @@ ; tests every character on every number (defn sanitize-2 - "String -> String" + ":: String -> String" [input] (reduce (fn [acc str-pos] ; find which, if any, of the patterns matches on this pos ; match :: Maybe (String String) diff --git a/src/day02.clj b/src/day02.clj new file mode 100644 index 0000000..32b6111 --- /dev/null +++ b/src/day02.clj @@ -0,0 +1,19 @@ +(ns day02 + "Day 02 funtions" + (:require + [utils] + [clojure.string])) + +(def contents ":: String" (utils/read-file "01" false)) +(def lines ":: Vector of String" (clojure.string/split-lines contents)) + +(defn part1 + ":: () -> String" + [] + "") + +(defn part2 + ":: () -> String" + [] + "") +