seq-contains? in practice

2010-04-29 Thread Stuart Halloway
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

Re: seq-contains? in practice

2010-04-29 Thread Meikel Brandmeyer
Hi, did you also check some? I would use (some #{item} coll) or (some #(= % item) coll) from core instead of sucking in 3.5Mb contrib for includes?. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: seq-contains? in practice

2010-04-29 Thread Stuart Halloway
Good point, and no. There are several (but not dozens) of calls to some. It appears that all of them are places where search is known to be O(n) on small data, and (most importantly!) *none* of them include an instance check to see if there is an associative collection available. Stu

Re: seq-contains? in practice

2010-04-29 Thread Antony Blakey
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

Re: seq-contains? in practice

2010-04-29 Thread Douglas Philips
On 2010 Apr 29, at 8:27 AM, Meikel Brandmeyer wrote: did you also check some? I would use (some #{item} coll) or (some #(= % item) coll) from core instead of sucking in 3.5Mb contrib for includes?. Odd, isn't it, that there is a special function zero? when everyone could just use #(= 0 %)

Re: seq-contains? in practice

2010-04-29 Thread Stuart Halloway
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

Re: seq-contains? in practice

2010-04-29 Thread Mike K
On Apr 29, 5:10 am, Stuart Halloway stuart.hallo...@gmail.com wrote: (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.) For those of us who are newbies, would

Re: seq-contains? in practice

2010-04-29 Thread Laurent PETIT
The final proposition in the other thread to rename contains? into contains-key? and seq-contains? into contains-val? seems good, no ? Don't you think they are better names ? (contains-key? indicates more clearly that the coll is viewed as an associative thing ; contains-val? implies it will work

Re: seq-contains? in practice

2010-04-29 Thread Meikel Brandmeyer
Hi, On 29 Apr., 15:34, Douglas Philips d...@mac.com wrote: did you also check some? I would use (some #{item} coll) or (some #(= % item) coll) from core instead of sucking in 3.5Mb contrib for includes?. Isn't your real beef/bug-report here that you won't use a meaning/ intention

Re: seq-contains? in practice

2010-04-29 Thread MarkSwanson
On Apr 29, 9:57 am, Stuart Halloway stuart.hallo...@gmail.com wrote: 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

Re: seq-contains? in practice

2010-04-29 Thread Heinz N. Gies
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

Re: seq-contains? in practice

2010-04-29 Thread Stefan Kamphausen
Hi, On 29 Apr., 14:10, Stuart Halloway stuart.hallo...@gmail.com wrote: In theory, you may be right about 'contains?.' In practice, Rich   Hickey is right. - Stu Halloway. :-) probably a little off-topic, but to me the most irritating thing about contains? is, that it just returns nil (RT/F,