Hi,

while studying the collection types and trying to find out which
functions work on all collection types (i.e. lists, vectors, maps,
sets) I was flabbergasted by the following

user> (contains? (list 1 2 3) 3)
false

OK, the doc of contains? told me that for indexed collection-types it
will only check, whether the index is within the valid range.  So
maybe:

user> (contains? (list 1 2 3) 1)
false

At that point I dived into the implementation and found that in
RT.java checks for the type of collection passed but leaves out
PersistenList.

I'd like to understand the (probably well-grounded) reason for that.
As far as I can see PersistentList extends Counted, so the check for
the index-range should at least be possible.  However, I think people
would expect an equality check in the background, which OTOH would be O
(N), probably.

Kind regards,
Stefan

-- 
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

Reply via email to