On Tue, Nov 16, 2010 at 3:23 AM, atreyu <atreyu....@gmail.com> wrote:
> impenetrable for builtin curried functions and . operator as comp?? i
> dont think so, haskell can be hard to read but not for those reasons
> F. e. filter when the sum of elements are even:
>
> Prelude> filter (even.sum) [[2,3],[3,3]]
> [[3,3]]
>
> i think is pretty readable ;-)

user=> (filter (comp even? (partial apply +)) [[2 3] [3 3]])
([3 3])

is not too shabby either ;)

The major bit of ickiness is the need to use (partial apply +) to get
sum. If you (defn sum [coll] (apply + coll)) then you can use

(filter (comp even? sum) [[2 3] [3 3]])

which avoids icky infix notation ;) and can be shortened further if
you alias comp with e.g.

(def o comp)

to

(filter (o even? sum) [[2 3] [3 3]])

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