count

functionsince v0.0-927 clojure.core/countEdit
(count coll)

Details:

Returns the number of items in coll.

count works on arrays, lists, maps, sets, strings, and vectors.

(count nil) returns 0.


Examples:

(count [1 2 3])
;;=> 3

(count [])
;;=> 0

(count nil)
;;=> 0

(count #{:a :b})
;;=> 2

(count {:key "value" :key2 "value2"})
;;=> 2

Source docstring:
Returns the number of items in the collection. (count nil) returns
0.  Also works on strings, arrays, and Maps
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn count
  [coll]
  (if-not (nil? coll)
    (cond
      (implements? ICounted coll)
      (-count coll)

      (array? coll)
      (alength coll)

      (string? coll)
      ^number (.-length coll)

      (implements? ISeqable coll)
      (accumulating-seq-count coll)

      :else (-count coll))
    0))