[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: kcl "some" question



The definition at my hand DOES return the first non-NIL value.
Use the following code in file lsp/seq.lsp, if it is different from yours.
The online document for "some", yes, has a bug.


(defun some (predicate sequence &rest more-sequences)
  (setq more-sequences (cons sequence more-sequences))
  (do ((i 0 (1+ i))
       (l (apply #'min (mapcar #'length more-sequences))))
      ((>= i l) nil)
    (declare (fixnum i l))
    (let ((that-value
           (apply predicate
                  (mapcar #'(lambda (z) (elt z i)) more-sequences))))
      (when that-value (return that-value)))))


-- Taiichi