On Jun 28, 2009, at 11:48 AM, Handkea fumosa wrote:
On Jun 28, 11:27 am, Rich Hickey <richhic...@gmail.com> wrote:Deducing it doesn't contain 5 because it was passed a key incomparableto 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 don't agree that it is a bug to have (contains? 5 (sorted-set "foo" "bar" "baz")).
In a call to contains?, the collection is the first argument: user=> (doc contains?) ------------------------- clojure.core/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 arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'. nil
The really weird thing is, at my REPL the above yields the expected false rather than an exception.
--Steve
smime.p7s
Description: S/MIME cryptographic signature