News for hackers. Stuff that matters.
Re:The Beauty of Clojure by diego on Wednesday August 26, 2015 @02:29AM (#10121398)
(comp inc inc) is weird. You'd normally use #(+ 2 %) or (partial + 2) instead.
Re:The Beauty of Clojure by owen4d on Thursday August 27, 2015 @04:51AM (#10128296)
Yeah, definitely. My bad. It's definitely not idiomatic.

I think was trying to avoid using the anonymous fn syntax, as I thought that was be more off-putting, and partial hadn't occurred to me at the time. In the end, I think I just confused the issue.

In retrospect, I should probably have used a totally different example, and avoided map and reduce as they are FP idioms. Live and learn, as they say.

Re:The Beauty of Clojure by zeekay on Wednesday August 26, 2015 @06:18AM (#10122054)

  (reduce + (map (partial + 2) (range 10)))
...reads great in my opinion. Surprised no one else has brought it up.