From 3ccb86e948ba6ac797476ed3c4caad79395f2a3f Mon Sep 17 00:00:00 2001 From: Hunky Jimpjorps Date: Thu, 1 Dec 2022 08:59:41 -0500 Subject: day 1 complete --- 2022/day-01/day-01.ipynb | 10 +++++----- 2022/day-01/day-01.rkt | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to '2022') 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 +)) -- cgit v1.2.3