anchor.diff:  
   (defun lcs (a b)
     "Compute the longest common subsequence of vectors `a' and `b'"
  -  (extract-lcs a (lcs-positions a b)))
  +  (map 'vector (lambda (i) (aref a i)) (lcs-positions a b)))
  +
  +(defun lcs-length (a b)
  +  "Compute the length of the longest common subsequence of vectors `a' and `b'"
  +  (multiple-value-bind (table m n) (%lcs-table a b)
  +    (aref table n m)))
   
   (defun lcs-positions (a b)
     "Find the indices in a and b of the elements of the LCS."
  
positive.code:              (t (error "Assertion gone haywire: ~s ~s" j i)))))
      (values a-indices b-indices))))
  
  (defun extract-lcs (v indices)
    (map 'vector (lambda (i) (aref v i)) indices))
  
  (defun lcs-length (a b)
    "Compute the length of the longest common subsequence of vectors `a' and `b'"
    (multiple-value-bind (table m n) (%lcs-table a b)
      (aref table n m)))
  
  (defun similarity (a b)
    "Compute the similarity of vectors `a' and `b' in terms of the
  average of the ratios of the length of the LCS to their length."
    (let ((lcs-length (lcs-length a b)))
      (/ (+ (/ lcs-length (length a)) (/ lcs-length (length b))) 2.0d0)))
  
  (defun one-way-similarity (a b)
    "Like `similarity' but in only one direction."
    (float (/ (lcs-length a b) (length a)) 0d0))
  
  (defun %lcs-table (a b)
    ;; This is implemented with a simple dynamic programming algorithm.
    ;; There are some optimizations to be had but I haven't put them in
    ;; yet.
    (let* ((m (length a))
           (n (length b))
           (table (make-array (list (1+ n) (1+ m)) :initial-element 0)))
  
negative.code:               (setf (aref table j i) (lcs-length j i)))))
  
      (values table m n)))
  
  (defun similarity (a b)
    "Compute the similarity of vectors `a' and `b' in terms of the
  average of the ratios of the length of the LCS to their length."
    (let ((lcs-length (lcs-length a b)))
      (/ (+ (/ lcs-length (length a)) (/ lcs-length (length b))) 2.0d0)))
  
  (defun one-way-similarity (a b)
    "Like `similarity' but in only one direction."
    (float (/ (lcs-length a b) (length a)) 0d0))
  
  