3 ms·
(comp inc inc) is weird. You'd normally use #(+ 2 %) or (partial + 2) instead.
by diego 11y ago
(comp inc inc) is weird. You'd normally use #(+ 2 %) or (partial + 2) instead.
- zeekay 11y ago(reduce + (map (partial + 2) (range 10))) ...reads great in my opinion. Surprised no one else has brought it up.
- owen4d 11y agoYeah, 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.