No, it should be more explicit. "If called with a map..." "If called with a vector..."
Jonathan On Wed, Aug 7, 2013 at 8:32 PM, Michael Gardner <gardne...@gmail.com> wrote: > Wouldn't changing "collection" to "associative collection" be enough? > Though maybe a note about its behavior on vectors would also be good. > > On Aug 7, 2013, at 11:15 , Mark Engelberg <mark.engelb...@gmail.com> > wrote: > > > Yes, the discussion about contains? has come up before, but there's a > new aspect to this particular instance of the discussion that most of the > posts seem to be ignoring. > > > > The original poster specifically pointed out that his sequence was > constructed by calling the `keys` function on a map: > > (keys {:a "f" :b 23}) > > > > He then went on to point out that it doesn't return just a regular, > ordinary lazy sequence, but some sort of special type called a "KeySeq". > > > > The documentation says that `contains?` looks for whether a given "key" > is present. Probably when the documentation was written, there was some > assumption that by saying it looks for a "key", that makes it obvious it > only works on associative collections. > > > > But look here, we've got a sequence of keys. We know it is comprised of > keys, and obviously Clojure knows it is a sequence just of keys (because of > the custom type). Therefore, it was reasonable for the poster to think > that `contains?` would work on to determine whether a given key was in the > collection -- it is a collection with keys! > > > > So I think the new idea here, worthy of discussion, is this: > > > > How can we reword the doc for `contains?` so that it clearly does not > apply to a sequence of keys? > > > > -- > > -- > > 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 > > --- > > You received this message because you are subscribed to the Google > Groups "Clojure" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to clojure+unsubscr...@googlegroups.com. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.