Another idea on cutting down parentheses in Lisp (in particular Clojure). This somehow never dies… Can we ever get rid of this strawman?
Let's see this Clojure snippet.
(defn foo
[a b]
(bar a b))
This should be easy to read for the parenophobes without getting too much in panic: 6 parentheses (also counting the vector). Now let's translate this to Java.
Frobnicator foo(Baz a, Baz b) {
return a.bar(b);
}
So let's see… Hmm… Also 6 parentheses (counting the curly braces for the function). Heh? I thought Clojure is so heavy on parentheses! So Java must be just as bad. (And when the parenophobes complain about the curlys, we also drop the brackets and again have 4 vs. 4, no?)
Ok. Maybe just a bad example… Let's see again:
foo.bar().baz().frob().nicate(yoyo).dyne();
We count 10 parentheses! Now Clojure:
(-> foo bar baz frob (nicate yoyo) dyne)
Huh? Just 4?
So. If you think that Clojure is bad because it has „so much“ parentheses, please overcome your prejudice. It will be good for your personal as well as professional development.
Published by Meikel Brandmeyer on .
I'm a long-time Clojure user and the developer of several open source projects mostly involving Clojure. I try to actively contribute to the Clojure community.
My most active projects are at the moment VimClojure, Clojuresque and ClojureCheck.
Copyright © 2009-2014 All Right Reserved. Meikel Brandmeyer