FWIW I've had to re-remember this behavior of "contains?" several times, and to warn students off of it because it's so easy to think from the name that it's a general membership test. And the "some" idiom takes a while to remember.
The cheat sheet may indeed be contributing to the problem -- I do refer to it regularly -- and I think that changing that should help. Ideally (I know this is much easier said than done and that it will probably never be done, for reasonable reasons) it would be renamed "contains-key?" and "contains?" would do what everyone first assumes it will do. -Lee On Sep 5, 2011, at 2:21 PM, Stuart Sierra wrote: > Hi folks, just looking at the Clojure Cheat Sheet > http://clojure.org/cheatsheet > > The `contains?` function is under "Collections -> Collections -> Content > tests." That implies that it's testing the values of the collection, which it > doesn't exactly do, a frequent source of confusion. > > My suggestion: leave `contains?` in the "Collections -> Maps" section, add it > to "Collections -> Sets", but remove it from "Collections -> Content tests" > > Technically, `contains?` also works on vectors, but it's rarely useful that > way. > > Stuart Sierra > clojure.com -- 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