3 ms·
Well, a lot of it is that Lisp uses parens for everything while most other languages use a variety of syntactic tools. For example, declaring a bunch of variab
by chc 14y ago
Well, a lot of it is that Lisp uses parens for everything while most other languages use a variety of syntactic tools.
For example, declaring a bunch of variables in Lisp:
(let ((a 1)
(b 2)
(c 3))
(format t "They are ~D, ~D and ~D~%" a b c))
The same thing in C
int a = 1;
int b = 2;
int c = 3;
printf("They are %d, %d and %d\n", a, b, c);
Lisp used parens around the whole construct, as well as around the assignment list, around each individual assignment and to do the printing. C completely eschews some of these parens and uses = and ; to fill essentially the same role as the others. Only `printf()` keeps the parens. In short, C has lots of different syntactic symbols, while Lisp has relatively few.
To illustrate further, Clojure gets the "OMG parens" complaint a lot less than most Lisps because it consciously shies away from the traditional parens-everywhere look of Lisp. For example, the above code in Clojure:
(let [a 1
b 2
c 3]
(printf "They are %d, %d and %d\n" a b c))
Still more parens than C, but the difference is marked — the assignment block is clearly set apart by syntax, and the assignments are paired by juxtaposition rather than by grouping into lists. Parens are used relatively sparingly.
This isn't to say that this is really a problem, but the idea that parens in Lisp are equivalent to brackets in C isn't really right either. Parens in Lisp are used in place of nearly every bit of syntax in C, from braces to equals signs to semicolons.