Function: cl-member-if

cl-member-if is an autoloaded and byte-compiled function defined in cl-seq.el.gz.

This function is obsolete since 31.1; use member-if instead.

Signature

(cl-member-if PREDICATE LIST [:KEY KEY-FN])

Documentation

Find the first item satisfying PREDICATE in LIST.

Return the sublist of LIST whose car matches.

This function is obsolete: use member-if. The new function does not support the old :key KEY-FN argument, but it is better to compose any KEY-FN into PRED. For example, you can replace

    (cl-member-if #'foo items :key #'bar)

with

    (member-if (lambda (x) (foo (bar x))) items)

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-seq.el.gz
;;;###autoload
(defun cl-member-if (pred list &rest cl-keys)
  "Find the first item satisfying PREDICATE in LIST.
Return the sublist of LIST whose car matches.

This function is obsolete: use `member-if'.  The new function does not
support the old `:key KEY-FN' argument, but it is better to compose any
KEY-FN into PRED.  For example, you can replace

    (cl-member-if #\\='foo items :key #\\='bar)

with

    (member-if (lambda (x) (foo (bar x))) items)

(fn PREDICATE LIST [:KEY KEY-FN])"
  (declare (important-return-value t))
  (apply #'cl-member pred list :test #'funcall cl-keys))