Add day 12
[adventofcode2020.git] / src / utilities.lisp
index 6e0ca47d84f02726cd4becea7d1db06bc557b60d..ce9aa6d39ce67b27c0608dda35c3adf23e5e18b9 100644 (file)
         (wrap-A (mapcar #'list A)))
     (reduce helper C :initial-value (funcall helper wrap-A B))))
 
+(defun manhattan-distance (a b)
+  (destructuring-bind ((ax ay) (bx by)) (list a b)
+    (+ (abs (- ax bx))
+       (abs (- ay by)))))
+
 (def-suite util)
 (in-suite util)