You're viewing version 1.2.0 of coll?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

coll?

clojure.core

  • (coll? x)
Returns true if x implements IPersistentCollection

3 Examples top

  • user=> (coll? {})
    true
    
    user=> (coll? #{})
    true
    
    user=> (coll? [])
    true
    
    user=> (coll? ())
    true
    
    user=> (coll? 4)
    false
    
    user=> (coll? "fred")
    false
    
    user=> (coll? true)
    false
    
    user=> (coll? nil)
    false
    
  • user=> (coll? {:a 10 :b 20}) ; map is a collection of map-entries
    true
  • ;; contrast to example code for sequential?
    ;;
    user> (coll? '(1 2 3))
    true
    user> (coll? [1 2 3])
    true
    user> (coll? (range 1 5))
    true
    user> (coll? 1)
    false
    user> (coll? {:a 2 :b 1})   
    true
    user> (coll? {:a 2 :b 1})  ; in contrast to sequential?, coll? returns true for a hash map
    true
    user> (sequential? {:a 2 :b 1})
    false
Log in to add / edit an example.

See Also top

Log in to add a see also.

Comments top

No comments for coll?. Log in to add a comment.