(defparameter *lines* '((0 1) (0 2 4 6) (0 3 7 9) (0 5 8 10) (1 2 3 5) (1 4 7 8) (1 6 9 10))) (defun points (x &optional y) (loop for p in *lines* when (and (member x p) (not (member y p))) append (remove x p))) (defun solve-challenge (&aux (results '())) (dolist (x (delete-duplicates (reduce #'append *lines*))) (let ((cx (points x))) (dolist (y (remove-if (lambda (i) (< i x)) cx)) (dolist (z (points y x)) (when (and (> z y) (member z cx)) (push (list x y z) results)))))) results)