The problem is you're unnecessarily conflating the value by which to base a sort (x and y in your example) with the elements of the set. Equality and ordinality are not the same thing. It should be perfectly reasonable to hand someone a set of unique objects sorted by some non-unique attribute of the elements of the set.
On Apr 16, 10:13 am, Per Vognsen <[email protected]> wrote: > On Sat, Apr 17, 2010 at 12:01 AM, Sean Devlin <[email protected]> > wrote: > > I know you might not like it, but there is a convention in JavaLand > > that a comparator value of 0 is identical in a sorted collection. > > It's not a Java convention. It's intrinsic to the business of sorting. > For sorting to give well-defined results, it must be based on an > ordering that respects the trichotomy law, which says that, for all x > and y, exactly one of the following three conditions must hold: x < y, > x = y, x > y. If you define the < and > based on a custom comparator > but use the default equality implementation for the = then you cannot > expect this to hold. Packaging all three relations together lets the > implementor of the comparator guarantee trichotomy. > > -Per > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group > athttp://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
