Function: cl-count
cl-count is an autoloaded and byte-compiled function defined in
cl-seq.el.gz.
Signature
(cl-count ITEM SEQ [KEYWORD VALUE]...)
Documentation
Count the number of occurrences of ITEM in SEQ.
Keywords supported: :test :test-not :key :start :end
Aliases
count (obsolete since 27.1)
org-count (obsolete since 9.0)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-seq.el.gz
;;;###autoload
(defun cl-count (item seq &rest cl-keys)
"Count the number of occurrences of ITEM in SEQ.
\nKeywords supported: :test :test-not :key :start :end
\n(fn ITEM SEQ [KEYWORD VALUE]...)"
(declare (important-return-value t))
(cl--parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end) ()
(let ((count 0) x)
(or cl-end (setq cl-end (length seq)))
(if (consp seq) (setq seq (nthcdr cl-start seq)))
(while (< cl-start cl-end)
(setq x (if (consp seq) (pop seq) (aref seq cl-start)))
(if (cl--check-test item x) (incf count))
(setq cl-start (1+ cl-start)))
count)))