Simplified Common Lisp reference
count
Symbol class: Sequences (Lists, Strings) and Arrays
Syntax:
Symbol type: function
countitemsequencetest(keyword)from-end(keyword)start(keyword)end(keyword)key(keyword)test(keyword)test-not(keyword) => integer
Argument description:
item an item to be found
sequence a sequence to be searched
test function key and item comparison
from-end direction of search, default is NIL - forward
start starting position for search, default is 0
end final position for search, default is NIL - end of sequence
key function for extracting value before test
test function for comparison of two values
test-not function for comparison of two values

COUNT function counts specified elements in sequence. Return value is number of occurancesf or NIL if no occurance is not found. See also COUNT-IF, POSITION, POSITION-IF, FIND, FIND-IF and MEMBER.

(count #\s "Some sequence") => 1
(count #\s "Some sequence" :key #'char-downcase) => 2
(count #\s "Some sequence" :key #'char-downcase :start 1) => 1
(count #\x "Some sequence") => 0
(count '(1 2) #(9 3 (1 2) 6 7 8)) => 0
(count '(1 2) #(9 3 (1 2) 6 7 8) :test #'equal) => 1
(count 1 #(0 1 0 0 0 1 0) :from-end t) => 2
Function indexFull documentation for count (HyperSpec)