I was surprised to find out that contains? checks keys, even on  
vectors. Is this idiomatic in some language? I think most new users to  
Clojure will find it confusing.

I propose that contains? checks values on vectors, leaving the  
behavior as-is for other collection types.

And yes, I understand the existing behavior is consistent (at the data  
structure level). But it doesn't meet user expectations.

> On Tue, 2008-09-30 at 17:29 -0400, Stuart Halloway wrote:
>> For your specific case you should probably be using contains?, which
>> works for both.
>
> No. contains? is meant for maps, i.e. when applied to vectors it  
> checks
> against indexes:
>
> user=> (contains? [1 2 3] 0)
> true
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to