r/Clojure • • May 24 '17

Readable Clojure

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

31 comments sorted by

View all comments

4

u/Severed_Infinity May 24 '17

Loved that post, certainly some things in there that made me think such as the vector destructuring of first and second. Going to adopt some of those principles for myself :)

2

u/[deleted] May 24 '17

Agreed on the destructuring in for and let, love the names.

But I've always felt that using destructuring on function parameters is not such a good thing because it makes it complex to read. Does anyone else agree with this? Maybe spec will change this somewhat?

2

u/daveliepmann May 24 '17

I find destructuring on function parms perfectly readable. Maybe I haven't come across it used in excess.

2

u/[deleted] May 24 '17

I think it depends on context. If it is obvious or somehow documented what the parameters are, then it's fine. For example in in my codebase at work, most of the functions in a namespace take the same arguments, so if you read some of the rest of the code then it's pretty clear what the shape of the data actually is. We also use spec as much as possible