anchor.diff:    (< (abs n) (expt 10 digits)))
   
   
  +(defun adjoin% (list item &rest keyword-args)
  +  (apply #'adjoin item list keyword-args))
  +
  +(define-modify-macro adjoinf (item &rest keyword-args) adjoin%)
  +
  +
  +(defun mv* (matrix vector)
  +  (iterate
  +    (with (rows cols) = (array-dimensions matrix))
  +    (initially (assert (= cols (length vector))))
  +    (with result = (make-array rows :initial-element 0))
  +    (for row :from 0 :below rows)
  +    (iterate (for col :from 0 :below cols)
  +             (for v = (aref vector col))
  +             (for a = (aref matrix row col))
  +             (incf (aref result row)
  +                   (* v a)))
  +    (finally (return result))))
  +
  +
  +(defun pythagorean-triplet-p (a b c)
  +  (= (+ (square a) (square b))
  +     (square c)))
  +
  +(defun pythagorean-triplets-of-perimeter (p)
  +  (iterate
  +    (with result = '())
  +    (for c :from 1 :to (- p 2))
  +    (iterate
  +      (for a :from 1 :below (min c (- p c)))
  +      (for b = (- p c a))
  +      (when (pythagorean-triplet-p a b c)
  +        (adjoinf result (sort (list a b c) #'<)
  +                 :test #'equal)))
  +    (finally (return result))))
  +
  +
  +(defun map-primitive-pythagorean-triplets (function stop-predicate)
  +  ;; http://mathworld.wolfram.com/PythagoreanTriple.html
  +  (let ((u #2A(( 1  2  2)
  +               (-2 -1 -2)
  +               ( 2  2  3)))
  +        (a #2A(( 1  2  2)
  +               ( 2  1  2)
  +               ( 2  2  3)))
  +        (d #2A((-1 -2 -2)
  +               ( 2  1  2)
  +               ( 2  2  3))))
  +    (recursively ((triple (vector 3 4 5)))
  +      (unless (apply stop-predicate (coerce triple 'list))
  +        (apply function (coerce triple 'list))
  +        (recur (mv* u triple))
  +        (recur (mv* a triple))
  +        (recur (mv* d triple))))))
  +
  +
   ;;;; Problems -----------------------------------------------------------------
   (defun problem-1 ()
     ;; If we list all the natural numbers below 10 that are multiples of 3 or 5,
  
positive.code:                (when (pandigitalp result)
                   (in main (maximizing result)))))))
  
  
  ;;;; Tests --------------------------------------------------------------------
  (def-suite :euler)
  
negative.code:   ;;
    ;; There exists exactly one Pythagorean triplet for which a + b + c = 1000.
    ;; Find the product abc.
    (product (first (pythagorean-triplets-of-perimeter 1000))))
  
  (defun problem-10 ()
    ;; The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
  