day1: revisit, simplify

master
Clyne 3 years ago
parent 0e3b0f4732
commit 945a0a01e0

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

Loading…
Cancel
Save