r/programming • • May 25 '17

Readable Clojure

http://tonsky.me/blog/readable-clojure/
42 Upvotes

35 comments sorted by

View all comments

11

u/maestro2005 May 25 '17

I disagree strongly with wrapping things in redundant some?/none? checks. (when thing ...) is entirely idiomatic and you should get used to reading it.

I agree that sometimes excessive comp/partial usage can be hard to read, but his example is bad:

(map (comp str/capitalize str/trim) strings)

Anyone who calls themselves competent in clojure should easily read this as "capitalize and trim the strings". This is actually a perfect use of comp. The benefit of comp/partial is that you avoid creating a new function, which creates a new reference frame and introduces a variable just to pass it along to another function.

Even as experienced Clojure programmer I haven’t developed a skill to parse such structures easily.

Then you're not really that experienced.

19

u/LoyalToTheGroupOf17 May 25 '17

Then you're not really that experienced.

You're talking about Nikita Prokopov, author of (among other things) datascript and rum. If he doesn't qualify as "experienced", I don't know who does.

I agree with your other points, though.

-9

u/maestro2005 May 25 '17

I don't care what he's created, if he's struggling with really basic FP concepts then I'm not really interested in his opinions on code grokability.

17

u/LoyalToTheGroupOf17 May 25 '17

He's not struggling with really basic FP concepts. He just disagrees with you (and with me) concerning when using some of them helps vs hinders readability. And he is definitely not inexperienced.