On Fri, Feb 27, 2009 at 12:47 AM, Allen Rohner <aroh...@gmail.com> wrote:
>
>
>> I agree regarding concatenation as well, but I think the case for
>> comparison of non-numerics is still pretty strong.
>>
>> -Phil
>
> Are you referring to using <, >, =, with objects that implement
> java.lang.Comparable?
>
> i.e. given x.compareTo(y) == -1
> (< x y)
> => true
>
> I would find that useful.

I think having <, >, <=, >= be based on Comparable has been discussed before.

And the conclusion was that it was a bad idea, because in Java:

user=> (.compareTo (Integer. "10") (Long. "10"))
java.lang.ClassCastException: java.lang.Long cannot be cast to
java.lang.Integer (NO_SOURCE_FILE:0)

And:

user=> (.equals (Integer. "10") (Long. "10"))
false

Whereas in Clojure:

user=> (< (Integer. "10") (Long. "10"))
false
user=> (= (Integer. "10") (Long. "10"))
true

Given these consequences, I think the current behavior is the best compromise.

>
> Allen
>
> >
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

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