aboutsummaryrefslogtreecommitdiff
path: root/2022/day-01/day-01.rkt
diff options
context:
space:
mode:
Diffstat (limited to '2022/day-01/day-01.rkt')
-rw-r--r--2022/day-01/day-01.rkt18
1 files changed, 16 insertions, 2 deletions
diff --git a/2022/day-01/day-01.rkt b/2022/day-01/day-01.rkt
index b29335d..2d01605 100644
--- a/2022/day-01/day-01.rkt
+++ b/2022/day-01/day-01.rkt
@@ -1,6 +1,20 @@
#lang racket
(require advent-of-code
- threading
- seq)
+ threading)
+(define calorie-data (fetch-aoc-input (find-session) 2022 1))
+
+;; part 1
+(~> calorie-data
+ (string-split "\n\n")
+ (map (λ~> string-split (map string->number _) (apply + _)) _)
+ (apply max _))
+
+;; part 2
+(~> calorie-data
+ (string-split "\n\n")
+ (map (λ~> string-split (map string->number _) (apply + _)) _)
+ (sort _ >)
+ (take 3)
+ (apply + _))