3 ms·
That's true for writing code, but I think the man benefit is when you're reading it. Parenthesis tell me that there is a function application occurring, and squ
by narwally 8y ago
That's true for writing code, but I think the man benefit is when you're reading it. Parenthesis tell me that there is a function application occurring, and square brackets tell be that bindings are being initialized. Then parenthesis, square brackets, and curly braces help me easily find lists, vectors, maps, and sets just from a quick visual scan of the code. Clojure also does a nice job of eliminating unnecessary parens, such as the ones surrounding pairs in a let binding. So instead of this:
(let ((x 1)
(y 2))
(+ x y))
In Clojure, it becomes:
(let [x 1
y 2]
(+ x y))
- pmoriarty 8y agoI don't think I've ever been confused as to which were the bindings in a let block. It's obvious from the indentation and the parenthesis. Granted, it's a bit easier to pick them out with square brackets, but for my taste I'd rather just have homegenous delimiters everywhere.
- kbp 8y ago> Then parenthesis, square brackets, and curly braces help me easily find lists, vectors, maps, and sets just from a quick visual scan of the code. How often do you want to do that? Wouldn't you be more interested in what the variable is called or who it's passed to?