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 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'."
Could it be possible to enhance the doc a little bit, or would it open a can of worms of documenting each and every exceptional corner case ? 2009/6/28 Meikel Brandmeyer <m...@kotka.de>: > 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 does not seem >> to me to be an error. > > I think it is, because there is some path in my > program where a wrong value can reach my > sorted-set. So I did something wrong somewhere > and I'd like to know about it. > > OTOH, this is maybe too much static type thinking... > > Sincerely > Meikel > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---