Re: ClassCastException - maybe a bug

2009-06-28 Thread Stephen C. Gilardi
On Jun 28, 2009, at 11:48 AM, Handkea fumosa wrote: On Jun 28, 11:27 am, Rich Hickey wrote: Deducing it doesn't contain 5 because it was passed a key incomparable to some other key seems like a stretch to me, and bug-hiding. Clojure is relatively free of exception catching in normal flow

Re: ClassCastException - maybe a bug

2009-06-28 Thread Handkea fumosa
On Jun 28, 11:27 am, Rich Hickey wrote: > Deducing it doesn't contain 5 because it was passed a key incomparable > to some other key seems like a stretch to me, and bug-hiding. > > Clojure is relatively free of exception catching in normal flow of > control, and I'm disinclined to start here. I

Re: ClassCastException - maybe a bug

2009-06-28 Thread Rich Hickey
On Sat, Jun 27, 2009 at 4:30 PM, Handkea fumosa wrote: > > On Jun 27, 11:32 am, Meikel Brandmeyer wrote: >> Am 26.06.2009 um 23:44 schrieb Michael Spiegel: >> > =>(def foo (sorted-set "bob" "alice" "michael")) >> > => (contains? foo 5) >> > java.lang.ClassCastException: java.lang.String cannot be

Re: ClassCastException - maybe a bug

2009-06-28 Thread Laurent PETIT
Hi, I can understand both points of vue, since the documentation is not explicit about the possibility to return an error ? "(contains? coll key) Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java ar

Re: ClassCastException - maybe a bug

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 27.06.2009 um 22:30 schrieb Handkea fumosa: I'd agree that a ClassCastException is not inappropriate if you try to put heterogeneous objects into a sorted-set. But contains? should probably just return true or false, never throw. Michael's set doesn't contain 5; asking whether it does d

Re: ClassCastException - maybe a bug

2009-06-27 Thread Handkea fumosa
On Jun 27, 11:32 am, Meikel Brandmeyer wrote: > Am 26.06.2009 um 23:44 schrieb Michael Spiegel: > > =>(def foo (sorted-set "bob" "alice" "michael")) > > => (contains? foo 5) > > java.lang.ClassCastException: java.lang.String cannot be cast to   > > java.lang.Number (NO_SOURCE_FILE:0) > > IIRC, th

Re: ClassCastException - maybe a bug

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 26.06.2009 um 23:44 schrieb Michael Spiegel: Running the following test code generates an exception: =>(def foo (sorted-set "bob" "alice" "michael")) => (contains? foo 5) java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number (NO_SOURCE_FILE:0) I've tracke