adventofcode2022

My solutions for Advent of Code 2022
Log | Files | Refs

commit 20305305048082a2c4101a8938a1c630f34fe56b
parent 660507020d19e1d7c591187a4e4bda009ff44c6a
Author: Lukas Henkel <lh@entf.net>
Date:   Sat,  3 Dec 2022 10:59:08 +0100

Checking the length is not needed

Diffstat:
Msrc/day03.lisp | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/day03.lisp b/src/day03.lisp @@ -25,9 +25,7 @@ (defun task2 (inputs) (loop with head = inputs - with length = (length inputs) for end from 3 - while (<= end length) when (= 0 (mod end 3)) sum (loop for item = #\A then (cond ((char= item #\Z) #\a) ((char= item #\z) nil) @@ -36,7 +34,8 @@ until (loop for i from 0 to 2 always (find item (elt head i))) finally (return (calculate-priority item))) - and do (setf head (cdddr head)))) + and do (setf head (cdddr head)) + while head)) (define-day 3 ()