Function: cl-assoc

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

Signature

(cl-assoc ITEM LIST [KEYWORD VALUE]...)

Documentation

Find the first item whose car matches ITEM in LIST.

Keywords supported: :test :test-not :key

View in manual

Aliases

assoc* (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-seq.el.gz
;;;###autoload
(defun cl-assoc (cl-item cl-alist &rest cl-keys)
  "Find the first item whose car matches ITEM in LIST.
\nKeywords supported:  :test :test-not :key
\n(fn ITEM LIST [KEYWORD VALUE]...)"
  (declare (compiler-macro cl--compiler-macro-assoc))
  (if cl-keys
      (cl--parsing-keywords (:test :test-not :key :if :if-not) ()
	(while (and cl-alist
		    (or (not (consp (car cl-alist)))
			(not (cl--check-test cl-item (car (car cl-alist))))))
	  (setq cl-alist (cdr cl-alist)))
	(and cl-alist (car cl-alist)))
    (if (and (numberp cl-item) (not (fixnump cl-item)))
	(assoc cl-item cl-alist)
      (assq cl-item cl-alist))))