The built-in Java comparison operators don't honor Comparable either. In Clojure, it's about keeping (pure number) math fast.

If you are doing any nontrivial date work, I recommend you look at clj- time (http://github.com/clj-sys/clj-time), a Clojure wrapper for Joda Time. Then, if you really want "<" and ">" to work, you can define them in your own namespace to wrap clj-time's "after?" and "before?".

Stu

I've been writing a program that requires the use of java.util.Calendar and its descendent java.util.GregorianCalendar. One thing I'd hoped to do was compare two Calendar objects with <, but the compiler complained that the arguments to < didn't inherit from Number which was a surprise to me because Calendar does inherit from java.lang.Comparable which in java land would be sufficient to enable it to be compared with other members of its class using the built in java comparison operators. Since I know that clojure has other operations that deal with comparable, I assume this is a conscious decision, but I question why it should be so.

Regards,
Bill

--
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 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

Reply via email to