Function: cl-some

cl-some is an autoloaded and byte-compiled function defined in cl-extra.el.gz.

Signature

(cl-some PREDICATE SEQ...)

Documentation

Say whether PREDICATE is true for any element in the SEQ sequences.

More specifically, the return value of this function will be the same as the first return value of PREDICATE where PREDICATE has a non-nil value.

View in manual

Aliases

org-some (obsolete since 9.0) some (obsolete since 27.1) filesets-some (obsolete since 28.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-extra.el.gz
;;;###autoload
(defun cl-some (pred seq &rest rest)
  "Say whether PREDICATE is true for any element in the SEQ sequences.
More specifically, the return value of this function will be the
same as the first return value of PREDICATE where PREDICATE has a
non-nil value.

\n(fn PREDICATE SEQ...)"
  (declare (important-return-value t))
  (if (or rest (nlistp seq))
      (catch 'cl-some
        (apply #'cl-map nil
               (lambda (&rest x)
                 (let ((res (apply pred x)))
                   (if res (throw 'cl-some res))))
               seq rest) nil)
    (let ((x nil))
      (while (and seq (not (setq x (funcall pred (pop seq))))))
      x)))