I would be surprised if you are still happy with that solution a few minutes after doing some testing with it.
I've added some examples to ClojureDocs.org at the link below, with a suggested better comparison function. Take a look and let me know if it seems clear: http://clojuredocs.org/clojure_core/clojure.core/sorted-set-by I've written some text explaining why the simpler comparison functions fail, but it is over 100 lines long right now and I should trim it down or find a different place for it than ClojureDocs.org. Andy On Nov 20, 2012, at 8:01 AM, JvJ wrote: > Simple solution. It works! Thanks. > > On Tuesday, 20 November 2012 10:59:23 UTC-5, Bronsa wrote: > what about using <= as sorting fuction? > > 2012/11/20 JvJ <kfjwh...@gmail.com> > First of all: I don't EXACTLY mean duplicate elements. I just mean > duplicates in those parts of the elements which are compared. > > For instance, I recently tried to have a sorted set of 2-element vectors > where the comparator < was used on the second element, however, something > like this happened: > > (sorted-set-by #(< (second %) (second %2)) > [:a 1] > [:b 1] > [:c 1]) > > ==> #{[:a 1]} > > > Does anyone know how I could have a set that includes all of these elements? -- 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