On Thu, Jan 29, 2009 at 5:32 PM, Dan Larkin <d...@danlarkin.org> wrote:
>
> On Jan 29, 2009, at 5:23 PM, Cosmin Stejerean wrote:
>>
>> If in? was to be added how would it behave when given a map as the
>> first argument? I would rather have "contains?" do the right thing
>> for list/vectors/sets and keep its current behavior for maps. If we
>> do actually need a function like contains that ONLY accepts a map as
>> the first argument I think a name like has-key? is the most intuitive.
>
> I think "in?" would behave like "contains?" when given a map:
>
> (in? {:a 1 :b 2 :c 3} :a) => true
> (in? {:a 1 :b 2 :c 3} :d) => false

I thought we had beaten this one entirely to death:
http://groups.google.com/group/clojure/browse_thread/thread/ff224d2b88b671e7/575cefc2c03ce154

And yet it lives!

What is the drawback of the (some #{:y} [:x :y :z]) idiom?  Is it too
verbose?  Too slow?  Too flexible?  Too good a re-use of existing
functionality?  Too helpful in opening ones eyes to the possibilities
of sets and higher order functions?

And if you really don't want to use it (why again?) there is
clojure.contrib.seq-utils/includes?, so why not use that?

--Chouser

--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to