by nickbauman · 12y ago · 0 comments
(sort #(compare %1 %2) coll)
To reverse it
(sort #(compare %2 %1) coll)
Where coll is the collection you want to sort. Same caveat applies with:
(reverse coll)
Try as I might I can't get Clojure to bench slower than its comparative Java. I see no reason to program in Java anymore wherever possible.
coll.sort(comparing(identity(), Integer::compareTo));
Or:
coll.sort(reverseOrder())