empty?

clojure.core

  • (empty? coll)
Returns true if coll has no items - same as (not (seq coll)).
Please use the idiom (seq x) rather than (not (empty? x))

3 Examples top

  • user=> (empty? ())
    true
    user=> (empty? '(1))
    false
  • user=> (every? empty? ["" [] () '() {} #{} nil])
    true
    
    ;example of recommended idiom for testing if not empty
    user=> (every? seq ["1" [1] '(1) {:1 1} #{1}])
    true
  • user=> (drop-while empty? ["" [] "foobar"])
    ("foobar")
    
Log in to add / edit an example.

See Also top

  • 0
    clojure.core/seq

    Returns a seq on the collection. If the collection is empty, retu

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:5446 top

(defn empty?
  "Returns true if coll has no items - same as (not (seq coll)).
  Please use the idiom (seq x) rather than (not (empty? x))"
  {:added "1.0"
   :static true}
  [coll] (not (seq coll)))
Vars in clojure.core/empty?:
Used in 0 other vars

Comments top

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