File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1
1
(defproject adventofcode " 0.1.0-SNAPSHOT"
2
2
:description " FIXME: write description"
3
3
:url " http://example.com/FIXME"
4
- :dependencies [[org.clojure/clojure " 1.10 .1" ]
4
+ :dependencies [[org.clojure/clojure " 1.11 .1" ]
5
5
[org.clojure/math.combinatorics " 0.1.4" ]
6
6
[org.clojure/core.match " 0.3.0-alpha4" ]
7
7
[net.cgrand/xforms " 0.18.2" ]
Original file line number Diff line number Diff line change
1
+ (ns aoc22.day01
2
+ (:require [clojure.java.io :as io]
3
+ [clojure.string :as str]))
4
+
5
+ (def input (slurp (io/resource " 2022/day01" )))
6
+
7
+ (->> (str/split input #"\n\n " )
8
+ (map str/split-lines)
9
+ (map #(map parse-long %))
10
+ (map #(apply + %))
11
+ (sort >)
12
+ (take 3 )
13
+ ; (apply +)
14
+ )
15
+ ; => (69795 69434 69208)
Original file line number Diff line number Diff line change @@ -14,5 +14,5 @@ for calo in readFile("../../resources/2022/day01").splitLines:
14
14
t3 = total
15
15
total = 0
16
16
17
- echo t1
18
- echo t1 + t2 + t3
17
+ echo t1 # 69795
18
+ echo t1 + t2 + t3 # 208437
You can’t perform that action at this time.
0 commit comments