(defun d2p1 (file) (loop with x = 0 and y = 0 for (direction amount) on (read-values file) by #'cddr do (ecase direction (forward (incf x amount)) (up (setf y (max 0 (- y amount)))) (down (incf y amount))) finally (return (* x y))))