add new libary functions aoc-clj

This commit is contained in:
Tobias Huttner 2022-12-13 20:44:37 +01:00
parent cf4603617c
commit 6f630a68e6
1 changed files with 16 additions and 0 deletions

View File

@ -7,3 +7,19 @@
io/resource
io/reader
line-seq))
(defn two-part-input [year day]
(let [input (read-lines year day)
empty-line? #(= "" %)]
[(vec (take-while empty-line? input))
(vec (rest (drop-while empty-line? input)))]))
(defn two-part-input [year day]
(let [input (read-lines year day)
two-parts (split-at (count (take-while #(not= "" %) input))
input)]
[(vec (first two-parts))
(vec (rest (second two-parts)))]))
(defn input-line [year day]
(first (aoc/read-lines year day)))