ClojureDocs

Nav

Namespaces

counted?

clojure.core

Available since 1.0 (source)
  • (counted? coll)
Returns true if coll implements count in constant time
2 Examples
user=> (counted? [:a :b :c])
true

user=> (counted? '(:a :b :c))
true

user=> (counted? {:a 1 :b 2 :c 3})
true

user=> (counted? #{:a :b :c})
true

user=> (counted? "asdf")
false

user=> (counted? (into-array Integer/TYPE [1 2 3]))
false
;; Lazy sequences are not counted?
(counted? (map inc (range 5)))
;;=> false
See Also

If coll is counted? returns its count, else will count at most the first n elements of coll using ...

Added by svenschoenung
0 Notes
No notes for counted?