Comparator.compare returns an int. (int 0.2) and (int -0.2) both return 0. Thus, your comparator is returning 0, saying "I don't care what order these go in".
On Mar 29, 6:44 pm, JvJ <kfjwhee...@gmail.com> wrote: > Alright check this out: > > ;; Normal subtraction as comparator sorts in ascending order > (sort-by identity #(- %1 %2) [1 -1]) > (-1 1) > > ;; Reverse subtraction as comparator sorts in descending order > (sort-by identity #(- %2 %1) [1 -1]) > (1 -1) > > ;;======================================= > ;; And now with values of -0.1, 0.1 > > ;; Reverse subtraction as comparator sorts in descending order > (sort-by identity #(- %2 %1) [0.1 -0.1]) > (0.1 -0.1) > > ;; Normal subtraction STILL sorts in descending order?? > (sort-by identity #(- %1 %2) [0.1 -0.1]) > (0.1 -0.1) -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.