Sorted maps are maps but they have an additional constraint that the keys
must be comparable according to the map's comparator.
Clojure intentionally does not define a total sort order crossing types
(there is no such ordering that makes sense).
You are however free to define your own comparato
Thank you for the response. Isn't that a leaky abstraction? Now all clients of
rename-keys woild have to care what the key type is. At the very least both
should implement Comparable and have some kind of general response for sorting.
--
You received this message because you are subscribed to
Sorted maps sort their keys, but keywords and strings are not comparable:
(sorted-map "a" 1 :b 2)
ClassCastException java.lang.String cannot be cast to clojure.lang.Keyword
clojure.lang.Keyword.compareTo (Keyword.java:114)
On Thursday, April 28, 2016 at 3:54:33 PM UTC-5, JPatrick Davenport