Returns the number of items in the collection. (count nil) returns
0. Also works on strings, arrays, and Java Collections and Maps
user=> (count nil)
0
user=> (count [])
0
user=> (count [1 2 3])
3
user=> (count {:one 1 :two 2})
2
user=> (count [1 \a "string" [1 2] {:foo :bar}])
5
user=> (count "string")
6
(defn count
"Returns the number of items in the collection. (count nil) returns
0. Also works on strings, arrays, and Java Collections and Maps"
{
:inline (fn [x] `(. clojure.lang.RT (count ~x)))
:added "1.0"}
[coll] (clojure.lang.RT/count coll))
Comments top
No comments for count. Log in to add a comment.