empty

clojure.core

  • (empty coll)
Returns an empty collection of the same category as coll, or nil

1 Example top

  • user=> (empty [1 2 3])
    []
    user=> (empty (list 1 2 3))
    ()
    user=> (map #(empty %) [[\a \b] {1 2} (range 4)])
    ([] {} ())
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:4558 top

(defn empty
  "Returns an empty collection of the same category as coll, or nil"
  {:added "1.0"
   :static true}
  [coll]
  (when (instance? clojure.lang.IPersistentCollection coll)
    (.empty ^clojure.lang.IPersistentCollection coll)))
Vars in clojure.core/empty:
Used in 0 other vars

Comments top

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