Frederick,

I agree with all you said; perhaps this is as much my personal coding
style. Also, I'm seeing Clojure through beginner's eyes. What I love
about Clojure is the readability and the "naturalness" of the names of
functions.

While skimming the API, I was looking for the natural opposite of (not-
any? pred coll) function. My initial though was, "Aha! There must be a
function (any? pred coll)". That only seems "natural" to me, since
there is both (every? pred coll) and (not-every? pred coll). It took
me quite a bit of searching to realize that (some pred coll) does what
I need. So, to me, (any? pred coll), just seems natural, even if it is
little more than sugar.

Also, comparing these two statements:

(disjoint? s1 s2)
(empty? (intersection s1 s2))

To me, the simpler the better, and therefore the more readable. So,
again, personally, I find the former to be easier, simpler, more
direct and to the point.

Thanks for the link too!

Cheers,

-Travis

On Jul 21, 6:14 pm, Frederick Polgardy <f...@polgardy.com> wrote:
> Oops, you already said that, my bad. :)
>
> --
> Science answers questions; philosophy questions answers.
>
> On Jul 21, 2010, at 8:13 PM, Frederick Polgardy wrote:
>
>
>
> > Or [using clojure.set] (empty? (intersection s1 s2)).
>
> > --
> > Science answers questions; philosophy questions answers.
>
> > On Jul 21, 2010, at 4:45 PM, Travis Hoffman wrote:
>
> >> The second function is suggested as an addition to clojure.set. The
> >> "disjoint?" function decides if two sets have no elements in common.
> >> This can easily be done using:
>
> >> (not (nil? (intersection s1 s2)))
>
> >> but this implementation should be more efficient (I think) and is more
> >> readable, imho:
>
> >> (defn disjoint?
> >> "Is set1 disjoint from set2?"
> >> {:added "1.3" :tag Boolean}
> >> [set1 set2]
> >> (if (<= (count set1) (count set2))
> >>   (recur set2 set1)
> >>   (not-any? (fn [item] (contains? item set1)) set2)))

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