This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Kawa numbers are now Comparable
- From: Per Bothner <per at bothner dot com>
- To: kawa at sources dot redhat dot com
- Date: Sat, 21 Feb 2004 15:07:38 -0800
- Subject: Kawa numbers are now Comparable
I checked into CVS patches to make the standard
Kawa number classes implement Comparable. So you
can now do things like:
(set! v (vector 1 0.5 5/2 8 2.5))
(java.util.Collections:sort v)
The implementation isn't 100% consistent with equals,
as I decided it makes sense to allow comparing
rational numbers with floating-point numbers, even
though they're not equals.
Let me know if you find any anomalies or bugs.
Next I'd like to let Symbol be comparable (but
only with they have the same Environment/namespace),
gnu.text.Char aka <char>
and some subset of the gnu.lists classes. Any opinions
on what makes most sense / is most useful? I think
that FString aka <string> should be Comparable, but
other gnu.lists.Sequence classes are less clear.
One could make a case for FVector aka <vector> as
well as LList aka <list> and perhaps SimpleVector
(which would automatically cover FVector as well the
various uniform vector types - though inefficiently).
--
--Per Bothner
per@bothner.com http://per.bothner.com/