anchor.diff:    (replace seq value :start1 start :end1 end)
     value)
   
  -(defun filter/counted (pred seq &key count from-end (start) end
  -                                     (key #'identity))
  +(defun filter/counted (pred seq &rest args
  +                       &key count from-end (start 0) end
  +                            (key #'identity))
     "Helper for FILTER."
     (fbind (pred key)
       (declare (dynamic-extent #'pred #'key))
  -    (let* ((seq (nsubseq seq (or start 0) end))
  -           (seq (if from-end (reverse seq) seq))
  -           (ret '())
  -           (len 0))
  -      (block nil
  -        (map nil
  -             (lambda (item)
  -               (when (pred (key item))
  -                 (push item ret)
  -                 (incf len)
  -                 (when (zerop (decf count))
  -                   (return))))
  -             seq))
  -      (make-sequence-like seq len
  -                          :initial-contents (if from-end
  -                                                ret
  -                                                (nreverse ret))))))
  +    (cond
  +      ;; Simple cases.
  +      ((= count 0) (make-sequence-like seq 0))
  +      ((> count (length seq)) (apply #'filter pred seq :count nil args))
  +      (t (let ((ret (make-bucket seq)))
  +           (block nil
  +             (map-subseq (lambda (item)
  +                           (when (pred (key item))
  +                             (bucket-push seq item ret)
  +                             (when (zerop (decf count))
  +                               (return))))
  +                         seq start end from-end))
  +           (let ((seq2 (bucket-seq seq ret)))
  +             (if from-end (nreverse seq2) seq2)))))))
   
   (defun filter (pred seq &rest args &key count &allow-other-keys)
     "Almost, but not quite, an alias for `remove-if-not'.
  
positive.code: 
       (mapcar #'first (assort list))
       ≡ (remove-duplicates list :from-end t)"
    (seq-dispatch seq
      (list-assort seq :key key :test test :start start :end end)
      (vector-assort seq :key key :test test :start start :end end)
      ;; Is there a more efficient way to do this while remaining
      ;; completely generic?
      (let* ((seq (nsubseq seq start end))
             (keys (nub (map 'list key seq) :test test)))
        (loop for k in keys
              collect (keep k seq :key key :test test)))))
  
  (defun list-runs (list start end key test)
    (fbind ((test (key-test key test)))
  
negative.code: 
       (filter #'oddp '(1 2 3 4 5) :count 2)
       => '(1 3)"
    (if count
        (apply #'filter/counted pred seq args)
        (apply #'remove-if-not pred seq args)))
  
  (assert (equal '(0 2 4 6 8) (filter #'evenp (iota 100) :count 5)))
  (assert (equalp #(0 2 4 6 8) (filter #'evenp (coerce (iota 100) 'vector) :count 5)))
  