This commit is contained in:
Adam Jeniski 2025-12-05 20:34:10 -10:00
parent d853e89137
commit 5289e1dfdf

View File

@ -6,14 +6,15 @@
(def num-line? (comp not #{\* \+} first))
(def nums-raw (take-while num-line? input))
(def nums (->> nums-raw
(map #(map parse-long (re-seq #"\d+" %)))))
(def nums (map (comp (partial map parse-long)
#(re-seq #"\d+" %))
nums-raw))
(def op-map {\+ +, \* *})
(def ops (as-> input v
(drop-while num-line? v)
(first v)
(filter (partial not= \space) v)
(mapv op-map v)))
(def ops (->> input
(drop-while num-line?)
(first)
(filter (partial not= \space))
(mapv op-map)))
;; part 1
(->> nums