day 1: shonks

This commit is contained in:
xenia 2020-12-01 16:34:16 -05:00
parent 58e8621d5b
commit 8925617afa
1 changed files with 14 additions and 0 deletions

14
1.rkt Normal file
View File

@ -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)))