function | since v0.0-927 | clojure.core/sort | Edit |
(sort coll)
(sort comp coll)
Returns a sorted sequence of the items in coll
.
comp
can be a boolean-valued comparison funcion, or a -/0/+ valued comparator.
comp
defaults to compare
.
Returns a sorted sequence of the items in coll. Comp can be boolean-valued comparison function, or a -/0/+ valued comparator. Comp defaults to compare.
(defn sort
([coll]
(sort compare coll))
([comp coll]
(if (seq coll)
(let [a (to-array coll)]
;; matching Clojure's stable sort, though docs don't promise it
(garray/stableSort a (fn->comparator comp))
(with-meta (seq a) (meta coll)))
())))