It's not a problem with Clojure, it's also how Java behaves. For sorted-sets to work properly, your comparator *must* satisfy the trichotomy property of orderings.
Consider a comparison predicate less?. The trichotomy property states that for all x,y, exactly one of the following hold: (less? x y) (less? y x) (= x y) In other words, if two things are treated by your comparison as "equal", they must actually be equal in the = sense. That's the issue. [1 :foo] and [1 :bar] are such that neither is considered less than the other, but neither are they equal. So your comparison operator does not work properly. Another way of thinking about is that your comparison operator must set up a strict linear order among all nonequal elements. If you take two unequal things, one must come out to be less than the other. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en