I believe contains? tests for the presence of a key in a collection:

user> (contains? {:a 1 :b 2} 1)
false
user> (contains? {:a 1 :b 2} :a)
true
user> (get [0 2 3] 1)
2
user> (contains? [0 2 3] 1)
true
user>

>From the docstring:

  "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'."

U

-- 
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

Reply via email to