src/2017/days/day-05.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 |
182bdd87fd9e |
children |
(none) |
(advent:defpackage* :advent/2017/05)
(in-package :advent/2017/05)
(defun compute (data modification-function)
(iterate
(with maze = (fresh-vector data))
(with bound = (1- (length maze)))
(with address = 0)
(while (<= 0 address bound))
(counting t)
(for offset = (aref maze address))
(callf (aref maze address) modification-function)
(incf address offset)))
(define-problem (2017 5) (data read-all) (342669 25136209)
(values
(compute data #'1+)
(compute data (lambda (value) (+ value (if (>= value 3) -1 1))))))