anchor.diff:                        (dotimes (i n)
                           (setf (elt sequence-1 (+ start1 i)) (elt sequence-2 (+ start2 i)))))))))))
     sequence-1)
  +
  +(declaim (inline replace))
  +(defun replace (sequence-1 sequence-2 &key (start1 0) end1 (start2 0) end2)
  +  (replace-known-args sequence-1 sequence-2 start1 end1 start2 end2))
   
   (defmacro object-type-dispatch (object &body body)
     "Fast CASE on (%OBJECT-TAG object)"
  
positive.code:                    (and (<= start2 start1) (< start1 end2))
                     (and (< start2 end1) (<= end1 end2))))
        (when (eql start1 start2)
          (return-from replace sequence-1))
        (setf copy-backwards t))
      (macrolet ((fast-vector (type)
                   `(if (and (typep sequence-1 '(array ,type (*)))
  
negative.code:                      (funcall key (aref vector i))
                       (funcall key (aref vector (1+ i)))))))
  
  ;; FIXME: This should also extract the length and return it too.
  (defun vector-type-element-type (type &optional environment)
    (let ((expanded-type (typeexpand type environment)))
      (cond ((and (listp expanded-type)
                  (member (first expanded-type) '(vector simple-array array))
                  (>= (length expanded-type) 2)
                  (not (eql (second expanded-type) '*)))
             (second expanded-type))
            ((subtypep expanded-type 'base-string environment)
             'base-char)
            ((subtypep expanded-type 'string environment)
             'character)
            ((subtypep expanded-type 'bit-vector environment)
             'bit)
            (t 't))))
  
  (define-compiler-macro concatenate (&whole whole &environment environment result-type &rest sequences)
    (flet ((bail () (return-from concatenate whole)))
      (when (not (and (consp result-type)
                      (eql (first result-type) 'quote)
                      (consp (rest result-type))
                      (null (cddr result-type))))
        (bail))
      (let ((type (second result-type)))
        (cond ((and (not (subtypep type 'null environment))
                    (subtypep type 'list environment))
               `(%concatenate-list ,@sequences))
              ((subtypep type 'vector environment)
               `(%concatenate-vector ',(upgraded-array-info
                                        (vector-type-element-type type environment))
                                     ,@sequences))
              (t (bail))))))
  
  (defun %concatenate-vector (array-info &rest sequences)
    (declare (dynamic-extent sequences))
    ;; Compute total length.
    (let* ((total-length (loop for seq in sequences summing (length seq)))
           (result (if (specialized-array-definition-tag array-info)
                       (make-simple-array-1 total-length array-info nil)
                       (make-array total-length
                                   :element-type (specialized-array-definition-type array-info))))
           (position 0))
      (dolist (seq sequences)
        (setf (subseq result position) seq)
        (incf position (length seq)))
      result))
  
  (defun %concatenate-list (&rest sequences)
    (declare (dynamic-extent sequences))
    (let* ((result (cons nil nil))
           (tail result))
      (declare (dynamic-extent result))
      (dolist (seq sequences)
        (if (listp seq)
            (dolist (elt seq)
              (setf (cdr tail) (cons elt nil)
                    tail (cdr tail)))
            (dotimes (i (length seq))
              (setf (cdr tail) (cons (aref seq i) nil)
                    tail (cdr tail)))))
      (cdr result)))
  
  (defun concatenate (result-type &rest sequences)
    (declare (dynamic-extent sequences))
    (cond
      ((subtypep result-type 'null)
       (let ((total-length (loop for seq in sequences summing (length seq))))
         (when (not (eql total-length 0))
           (error "Too many elements for result-type NULL."))
         nil))
      ((subtypep result-type 'list)
       (apply #'%concatenate-list sequences))
      ((subtypep result-type 'vector)
       (apply #'%concatenate-vector
              (upgraded-array-info (vector-type-element-type result-type))
              sequences))
      (t (error "Don't understand result-type ~S." result-type))))
  
  (define-compiler-macro every (predicate first-seq &rest more-sequences)
    (let* ((predicate-sym (gensym "PREDICATE"))
  