Agreed: Rich's explanation is the more important bit.

My point is that we may be wasting time arguing about something that nobody actually does. If idiomatic usage changes as the community grows, we *could* add a collection-generic contains.

While I have no position on seq-contains?, I question this methodology, which I've seen a few times now. It's early days for Clojure, you're sampling a very small codebase, and there may be as yet unforseen idiomatic uses (such as you point out for testing) which invalidates this argument. In addition I think you may be begging the question somewhat. Rich's explanation is more sound than this argument.

On 29/04/2010, at 9:40 PM, Stuart Halloway wrote:

"In theory, there is no difference between theory and practice. In practice, there is." -Yogi Berra (maybe).

The recent thread on the new seq functions spun off into a theoretical discussion about whether about the merits of having contains? and seq-contains? as separate functions. I would like to ground that discussion with some observations from real-world use:

Doing an O(n) search of a seq (via includes? or, under its new name, seq-contains?) occurs the following number of times in various libraries:

Clojure:                0.
Contrib:                0.
Compojure:      1. (and it's wrong--should be a set test)
Incanter:               0.

(There are a few calls to seq-contains? in the test suite for contrib, and I wrote all of them. If you write lots of unit tests you already know why such calls make sense there.)

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. :-)

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Man will never be free until the last king is strangled with the entrails of the last priest.
 -- Denis Diderot

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