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.
18 lines
384 B
Clojure
18 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.
|
|
;
|
|
|
|
(->> (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)
|
|
)
|
|
|