On Jan 29, 2009, at 2:55 PM, Cosmin Stejerean wrote: > > > On Thu, Jan 29, 2009 at 1:06 PM, Paul Mooser <taron...@gmail.com> > wrote: > > I know this has been discussed on the list before to some extent, but > does clojure by default have any operations which actually do what > "contains?" sounds like it would do, for all collections? I know that > you can easily write something similar using "some", but often times > you just want to find if something is in a list of items. > > I've seen Rich say that contains? is for associative things, but I > think it is an unfortunate name - if the idea is to express that the > collection has a value for that key, I think the name would ideally > express that, like: > > contains-key? > has-key? > maps? > > I would prefer has-key? for checking if a key is in a map and > contains? for checking if an element is in a collection.
What about leaving "contains?" as is and adding "in?" which would work like "in" in python. (contains? [1 2 50] 50) => false (in? [1 2 50] 50) => 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---