anchor.diff:  The name is from Arc."
     (declare (array-length n))
     (cond ((= n 0)
  -         (coerce-by-example '() seq))
  +         (make-sequence-like seq 0))
           ((= n 1)
  -         (coerce-by-example (list (extremum seq pred :key key)) seq))
  +         (make-sequence-like seq 1
  +                             :initial-contents (list (extremum seq pred :key key))))
           ((length<= seq n)
            (sort (copy-seq seq) pred :key key))
           (t (fbind ((key (if memo
  
positive.code:                                (heap-insert heap elt :key key :test #'test))))
                        (incf i))
                      seq)
                 (coerce-by-example
                  (take n (nreverse (heap-extract-all heap :key key :test #'test)))
                  seq))))))
  
  (dotimes (i 100)
    (let ((list (map-into (make-list 1000) (lambda () (random 1000)))))
  
negative.code: (defun make-heap (&optional (size 100))
    (make-array size :adjustable t :fill-pointer 0))
  
  (defun bestn (n seq pred &key (key #'identity) memo)
    "Partial sorting.
  Equivalent to (firstn N (sort SEQ PRED)), but much faster, at least
  