According to the docstring compare returns -1, 0 or 1: user=> (compare \b \g) -5
Regards, Tim. On Sep 8, 2:02 pm, Adrian Cuthbertson <adrian.cuthbert...@gmail.com> wrote: > Clojure's compare; > > (compare \a \b) > -1 > > user=> (doc compare) > ------------------------- > clojure.core/compare > ([x y]) > Comparator. Returns 0 if x equals y, -1 if x is logically 'less > than' y, else 1. Same as Java x.compareTo(y) except it also works > for nil, and compares numbers and collections in a type-independent > manner. x must implement Comparable > > Rgds, Adrian. > > On Tue, Sep 8, 2009 at 5:50 AM, Timothy Pratley<timothyprat...@gmail.com> > wrote: > > > Is there a way to deal with this: > > user=> (> \a \b) > > java.lang.ClassCastException: java.lang.Character cannot be cast to > > java.lang.Number (NO_SOURCE_FILE:0) > > > So far the only things I know are to coerce or use interop eg: > > user=> (.compareTo \a \b) > > -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 -~----------~----~----~----~------~----~------~--~---