aboutsummaryrefslogtreecommitdiffstats
path: root/day1/part1.clj
diff options
context:
space:
mode:
Diffstat (limited to 'day1/part1.clj')
-rw-r--r--day1/part1.clj16
1 files changed, 7 insertions, 9 deletions
diff --git a/day1/part1.clj b/day1/part1.clj
index 3316424..1c2c756 100644
--- a/day1/part1.clj
+++ b/day1/part1.clj
@@ -4,14 +4,12 @@
; the previous.
;
-(->> (slurp "./in")
- (clojure.string/split-lines)
- (map read-string)
+(as-> (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)
- )
+ #(cond-> (assoc %1 0 %2) (> %2 (first %1)) (update 1 inc))
+ [(first $) 0]
+ (rest $))
+ (println (second $)))