From 8925617afaac019aded00d02cd7f17ead447ed27 Mon Sep 17 00:00:00 2001 From: haskal Date: Tue, 1 Dec 2020 16:34:16 -0500 Subject: [PATCH] day 1: shonks --- 1.rkt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 1.rkt diff --git a/1.rkt b/1.rkt new file mode 100644 index 0000000..0d5f8fd --- /dev/null +++ b/1.rkt @@ -0,0 +1,14 @@ +#lang racket + +;; solution for day 1 + +(module+ main + (define nums (map string->number (file->lines "inputs/1"))) + + ;; part 1 + (for*/first ([a (in-list nums)] [b (in-list nums)] #:when (= 2020 (+ a b))) + (* a b)) + + ;; part 2 + (for*/first ([a (in-list nums)] [b (in-list nums)] [c (in-list nums)] #:when (= 2020 (+ a b c))) + (* a b c)))