It's easy to prove anything with a sufficiently small micro-benchmark. But "one line of Java" is not equivalent to "one line of Lisp", and even if it were, nobody writes Lisp code in a style that looks like a one-to-one mapping of some Java code.
This is like complaining that Japanese is inefficient because it has thousands of characters, or that English is inefficient because it takes dozens of characters to say what only takes a couple in Japanese. The concepts aren't exactly the same, and you can't just pick a trivial example and conclude that "this has fewer than that".
In your lower example, Clojure has only one more non alphanumeric character than the other example.
Furthermore, in Lisp, you always know that you have (function-name param param etc). Reading it becomes not just easier - it removes an entire layer of abstraction (syntax rules). Also, with smart editors, you gain the ability to move these around rapidly in ways that you simply cannot do with other languages.
Funny thing is, the biggest annoyance I have when not using Clojure is having to type commas between items in data structure. [1 2 3 4 5] just looks so much cleaner than [1, 2, 3, 4, 5]. I forget who wrote it, but they complained of seeing all the mouse turds "," in normal programming languages.
(let [x 5
y 10]
(foo x y))
(foo x y) ;; now different x and y!
In C, I'm often doing: {
foo *ptr = ...; // scope this just to this block.
}
I don't want ptr to be visible other than in that block, especially if it has gone invalid/null.The braces will be there if you program sanely and care about scope.
Sure, but so is the Clojure one. So I guess it's more like:
fun bar () {
let x = 5,
y = 10
foo(x,y)
}
vs (defn bar []
(let [x 5
y 10]
(foo x y)))
If you look at things other than function calls, it starts to look different:
vs I actually like Lisps and think the S expression syntax is one of their best features, but I'm not going to pretend there are the same number of brackets in Lisps as there are in C family languages.