> Not to be confused with empty?, which returns whether or not a collection is empty, empty returns an empty collection that is the same type as its argument:
No, actually, it returns an empty collection that is the same type as its argument OR NIL.
The 'or nil' is really important, and what makes `empty` really not that useful.
Say, for example, that I wanted to iterate over a generic collection, and modify each element recursively, while preserving the types. One would think this would work:
(defn map-recurse [coll f]
(if-not (coll? coll)
(f coll)
(into (empty coll) (map #(map-recurse % f) coll)))
Alas. You'll find that while maps are in theory lists of vector pair(empty (first {:a 1})) => nil
So empty really isn't very useful at all. If you know the collection will be one of the types that it supports, you might as well just create the empty collection explicitly - you know what type it is, after all.