> On May 12, 2015, at 4:28 PM, Fluid Dynamics <a2093...@trbvm.com> wrote: > > On Tuesday, May 12, 2015 at 3:34:46 PM UTC-4, Michael Gardner wrote: > On May 12, 2015, at 1:54 PM, Shantanu Kumar <kumar.s...@gmail.com > <javascript:>> wrote: > > I agree about the counter-intuitiveness. I'm only wondering whether the > > error message is a bit misleading "contains? not supported on type: > > java.lang.String" because of course (contains? "hello" 2) works fine. > > Can anyone comment on why Strings are explicitly supported here? > > Strings and arrays support constant-time access by index. The thing that's > broken is "contains? not supported on type: java.lang.String" instead of nil > when a nonnumeric key is used. One gets nil with a nonnumeric key and a > PersistentVector, rather than an exception.
The contains? function is just badly named, spawning a couple of different kinds of confusion. I know it's not going to change -- the problems have been pointed out for years. But FWIW I find it's usually best to pretend it doesn't exist, and when my students run into trouble with it I suggest that they do the same. -Lee -- 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/d/optout.