Re:Learning Clojure: comparing with Java streams
by madmax96 on Sunday November 04, 2018 @12:29PM
(#18376941)
It seems strange to me that
`(map extract-name justice-league)`
isn't listed under "idiomatic improvements." Supposing you already had `extract-name` defined for some reason, it's cleaner and simpler to just map that unary function than wrap that function in an anonymous function - whether that wrapping is done with the `#(...)` reader syntax or explicitly constructed with `fn`.
[ Parent
| on HN ]
Re:Learning Clojure: comparing with Java streams
by Sharlin on Sunday November 04, 2018 @01:37PM
(#18377328)
Or indeed `(map :name foo)` instead of the suggested (and redundant, linenoisy) `(map #(:name %) foo)`.
Re:Learning Clojure: comparing with Java streams
by patrickthebold on Sunday November 04, 2018 @12:56PM
(#18377103)
Oh that's a pet peeve of mine. Fun fact: it's called an eta expansion/reduction/conversion.
Re:Learning Clojure: comparing with Java streams
by fnordsensei on Sunday November 04, 2018 @01:21PM
(#18377255)
It certainly looks like a deliberate move to introduce anonymous functions and thus justify replacing the named function.