On Oct 3, 8:01 am, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> 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.
FYI, in clojure.contrib.seq-utils:
(defn includes?
"Returns true if s contains something equal (with =) to x."
[x s]
(if (some (fn [y] (= y x)) s)
true false))
Although I've found that whenever I use it, I'm better off using sets.
And I write "find" for vectors/sequences thus:
(first (filter #(some expression %) collection))
-Stuart
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---