about summary refs log tree commit diff
path: root/day01.rkt
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-12-02 16:33:53 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-12-02 16:34:48 +0100
commit3569846dad2bae95412762363ff9301f0540ab62 (patch)
treedecf8a3acda957acfb51198da576be834287ae27 /day01.rkt
parent37c6618115dc8d028b0e62dc11149973d733ef7c (diff)
downloadadventofcode2022-3569846dad2bae95412762363ff9301f0540ab62.tar.gz
adventofcode2022-3569846dad2bae95412762363ff9301f0540ab62.tar.xz
adventofcode2022-3569846dad2bae95412762363ff9301f0540ab62.zip
day01
Diffstat (limited to 'day01.rkt')
-rw-r--r--day01.rkt10
1 files changed, 10 insertions, 0 deletions
diff --git a/day01.rkt b/day01.rkt
new file mode 100644
index 0000000..0576f02
--- /dev/null
+++ b/day01.rkt
@@ -0,0 +1,10 @@
+#lang racket
+
+(define ordered-food
+  (sort (for/list ([para (string-split (file->string "day01") "\n\n")])
+          (for/sum ([line (string-split para "\n")])
+            (string->number line)))
+        >))
+
+(first ordered-food)                    ; 67016
+(apply + (take ordered-food 3))         ; 200116