On Sat, Nov 19, 2011 at 7:28 PM, Randy Pensinger <rspensin...@gmail.com> wrote: > user=> (def stringComparator > (comparator (fn [a b] > (do > (println (str "comparing '" a "' to '" b "'")) > (.compareTo a b))))) > #'user/stringComparator
The docs indicate comparator takes a predicate, i.e., a function that returns truthy or falsey. I changed your definition to this: (def stringComparator (comparator (fn [a b] (do (println (str "comparing '" a "' to '" b "'")) (neg? (.compareTo a b)))))) And that worked as expected: user> (.compare stringComparator "b" "a") comparing 'b' to 'a' comparing 'a' to 'b' 1 user> (.compare stringComparator "a" "a") comparing 'a' to 'a' comparing 'a' to 'a' 0 user> (.compare stringComparator "a" "b") comparing 'a' to 'b' -1 -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) -- 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