Skip to content

Commit ea3bc85

Browse files
committed
2022 day01.clj
1 parent 6bee18d commit ea3bc85

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(defproject adventofcode "0.1.0-SNAPSHOT"
22
:description "FIXME: write description"
33
:url "http://example.com/FIXME"
4-
:dependencies [[org.clojure/clojure "1.10.1"]
4+
:dependencies [[org.clojure/clojure "1.11.1"]
55
[org.clojure/math.combinatorics "0.1.4"]
66
[org.clojure/core.match "0.3.0-alpha4"]
77
[net.cgrand/xforms "0.18.2"]

src/aoc22/day01.clj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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)

src/aoc22/day01.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ for calo in readFile("../../resources/2022/day01").splitLines:
1414
t3 = total
1515
total = 0
1616

17-
echo t1
18-
echo t1 + t2 + t3
17+
echo t1 # 69795
18+
echo t1 + t2 + t3 # 208437

0 commit comments

Comments
 (0)