clojure is nice too for the example but if you'd add functions and they have arity more than 1 haskell gets better (imo of course):
user> (def concat2 (partial apply concat)) #'user/concat2 user> ((comp (partial map (partial + 5)) concat2) (filter (comp even? sum) [[2 3] [3 3] [6 6]])) (8 8 11 11) I added unnecessary parentheses to get closer to a lisp expression Prelude> ((map (5+).concat) (filter (even.sum) [[2,3],[3,3],[6,6]])) [8,8,11,11] but dont get me wrong i really like clojure :-P and the difference doesn't matter very much for me. With symbols would be... ((∘ (𝒫 map (𝒫 + 5)) concat2) (filter (comp even? sum) [[2 3] [3 3] [6 6]])) On Nov 16, 9:34 am, Ken Wesson <kwess...@gmail.com> wrote: > 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