On Apr 29, 2010, at 15:10 , Stuart Halloway wrote:

> "In theory, there is no difference between theory and practice. In practice, 
> there is." -Yogi Berra (maybe).
...
> Also, AFAICT, there are *no* examples of using instance checks to select the 
> right containment function.  So the theoretical concerns about this issue 
> have basically no exemplars in practice.
> 
> "In theory, you may be right about 'contains?.' In practice, Rich Hickey is 
> right." - Stu Halloway. :-)

We are discussing performance a lot here and usage (at least in the contrib. 
code) but I know I've ran into a wall with contains? more then once - 
admittedly in the end the code got re-factored and the whole mess removed but I 
am sure a lot  of the people will or have at one point tried to use contains? 
in the wrong way.
So while the discussion about performance and guarantees is nice, how about the 
WTF-factor or the it-just-works aspect?
Sure many of the important projects are made by high end experts but there are 
many many little people here too who really do mistakes like assuming 
(contains? '(1 2 3) 3) means that '(1 2 3) contains 3 since it reads like that.
There is no sense i asking '(1 2 3) if it has a index 3, so contains? should 
either not do that or be renamed.
I know I've dfiferent priorities then rich and most people from the dev team 
but I still say keeping things simple - and clojure does a great deal of that - 
is an very very important part.

So looking through my projects folder I find:
6 usages of some to test if elements are in a set
5 usages of not-any to test if elements are not in there
2 usages of contains (in a correct way)

So here my theory, contains? isn't used so rarely because it is not needed but 
because it does what it sounds like but not quite, so if it would do what it 
sounds like I bet people would use it more often.

Regards,
Heinz

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