You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
384 B
Clojure
16 lines
384 B
Clojure
; Day 1, part 1
|
|
; Read a list of numbers from stdin, separated by newlines.
|
|
; Count occurances of the current number being greater than
|
|
; the previous.
|
|
;
|
|
|
|
(as-> (slurp "./in") $
|
|
(clojure.string/split-lines $)
|
|
(map read-string $)
|
|
(reduce
|
|
#(cond-> (assoc %1 0 %2) (> %2 (first %1)) (update 1 inc))
|
|
[(first $) 0]
|
|
(rest $))
|
|
(println (second $)))
|
|
|