1.3.0 permalink Arrow_down_16x16

list?

clojure.core

  • (list? x)
Returns true if x implements IPersistentList

1 Example top

  • user=> (list? '(1 2 3))
    true
    user=> (list? (list 1 2))
    true
    user=> (list? 0)
    false
    user=> (list? {})
    false
    user=> (list? [])
    false
    user=> (list? (range 10))
    false
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:5459 top

(defn list?
  "Returns true if x implements IPersistentList"
  {:added "1.0"
   :static true}
  [x] (instance? clojure.lang.IPersistentList x))
Vars in clojure.core/list?:
Used in 0 other vars

Comments top

1 comment(s) for list?.

You may want to use seq? instead of list?, especially if you might be dealing with a lazy sequence as returned by filter, range, etc.

Log in to add a comment.