src/2021/days/day-01.lisp @ 2848a4548adf
2023/01 and 2022/01
Also start porting my test data to the new account, since Twitter imploded and
apparently it's impossible for a website to store a goddamn username and
password in The Year of Our Lord 2023 so everyone just outsources auth all
the time, ugh.
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 01 Dec 2023 11:05:43 -0500 |
parents |
166414163a73 |
children |
(none) |
(advent:defpackage* :advent/2021/01)
(in-package :advent/2021/01)
(define-problem (2021 1) (data read-numbers) (1754 1789)
(values
(iterate (for d :in (nthcdr 1 data))
(for p :in data)
(counting (> d p)))
;; The window total is a red herring. We only need to count when it
;; increases, and only increases when the number you're adding is larger
;; than the number you're subtracting.
(iterate (for d :in (nthcdr 3 data))
(for p :in data)
(counting (> d p)))))
#; Scratch --------------------------------------------------------------------