From f504d00a116a5f8ee090188a98ad54f894a9732b Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 2 Dec 2021 16:11:20 +0100 Subject: rakete --- 2021/01/solve.rkt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 2021/01/solve.rkt (limited to '2021/01/solve.rkt') diff --git a/2021/01/solve.rkt b/2021/01/solve.rkt new file mode 100644 index 0000000..4f1401d --- /dev/null +++ b/2021/01/solve.rkt @@ -0,0 +1,12 @@ +#lang racket + +(define LINES (map string->number (file->lines "input"))) + +(define (solve offset) + (for/sum ([x (in-list LINES)] + [y (in-list (drop LINES offset))] + #:when (< x y)) + 1)) + +(solve 1) +(solve 3) -- cgit v1.2.3