aboutsummaryrefslogtreecommitdiff
path: root/2022/day-01
diff options
context:
space:
mode:
authorHunky Jimpjorps <thechairman@thechairman.info>2022-12-01 08:59:41 -0500
committerHunky Jimpjorps <thechairman@thechairman.info>2022-12-01 08:59:41 -0500
commit3ccb86e948ba6ac797476ed3c4caad79395f2a3f (patch)
treef46aba5333fba064952ed20ac1e3e42db45b6fa0 /2022/day-01
parent02d222719eb63e1c301a5eacca07e94d8d676d84 (diff)
downloadgleam_aoc-3ccb86e948ba6ac797476ed3c4caad79395f2a3f.tar.gz
gleam_aoc-3ccb86e948ba6ac797476ed3c4caad79395f2a3f.zip
day 1 complete
Diffstat (limited to '2022/day-01')
-rw-r--r--2022/day-01/day-01.ipynb10
-rw-r--r--2022/day-01/day-01.rkt20
2 files changed, 15 insertions, 15 deletions
diff --git a/2022/day-01/day-01.ipynb b/2022/day-01/day-01.ipynb
index 59be327..d65785e 100644
--- a/2022/day-01/day-01.ipynb
+++ b/2022/day-01/day-01.ipynb
@@ -16,7 +16,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 1,
"metadata": {
"vscode": {
"languageId": "racket"
@@ -49,7 +49,7 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 2,
"metadata": {
"vscode": {
"languageId": "racket"
@@ -65,7 +65,7 @@
"70374"
]
},
- "execution_count": 9,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@@ -99,7 +99,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 3,
"metadata": {
"vscode": {
"languageId": "racket"
@@ -115,7 +115,7 @@
"204610"
]
},
- "execution_count": 7,
+ "execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
diff --git a/2022/day-01/day-01.rkt b/2022/day-01/day-01.rkt
index 2d01605..5215014 100644
--- a/2022/day-01/day-01.rkt
+++ b/2022/day-01/day-01.rkt
@@ -6,15 +6,15 @@
(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 _))
+(~>> 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 + _))
+(~>> calorie-data
+ (string-split _ "\n\n")
+ (map (λ~>> string-split (map string->number) (apply +)))
+ (sort _ >)
+ (take _ 3)
+ (apply +))