day1: revisit, simplify

master
Clyne 3 years ago
parent 0e3b0f4732
commit 945a0a01e0

@ -4,19 +4,14 @@
; the previous. ; the previous.
; ;
(loop [inc-count 0 (->> (slurp "./in")
prev (Integer/parseInt (read-line)) (clojure.string/split-lines)
] (map read-string)
(let [input (read-line)] (reduce
(if (not (empty? input)) #(update [%2 (second %1)] 1 (partial + (if (> %2 (first %1)) 1 0)))
(let [depth (Integer/parseInt input)] [999999 0]
(recur )
(if (> depth prev) (inc inc-count) inc-count) (second)
depth (println)
) )
)
(println inc-count)
)
)
)

Loading…
Cancel
Save