blob: df6d1010ef023f296151008d5cff62d4c8dbbe56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
(ns aocclj.day01
(:require [clojure.string :as str]))
(defn preprocess [input]
(sequence
(comp
(map parse-long)
(partition-by nil?)
(take-nth 2)
(map (partial reduce +)))
input))
(defn part1 [input]
(reduce max (preprocess input)))
(defn part2 [input]
(->> input preprocess (sort >) (take 3) (reduce +)))
|