3 ms·
Lisp-style parentheses are still better than brackets because at least they don’t waste verticat space. (if x (if y (if z foo))) versus
by xigoi 2y ago
Lisp-style parentheses are still better than brackets because at least they don’t waste verticat space.
(if x
(if y
(if z
foo)))
versus
if (x) {
if (y) {
if (z) {
foo;
}
}
}
- kazinator 2y agoBraces can be formatted in a Lisp-inspired style! Try it like this: if (x) { if (y) { if (z) { foo; } } } The rules are a little different. We have two-space indentation, like what is favored in Lisp, but there is a space after the opening brace. For symmetry, we put spaces between the closing ones. It works best if we don't "cuddle" the opening brace but put it on a new line. There is a rhyme and reason to it, and consistency. I've written some C programs that way, though not recently and can't point to any online examples. However, I also wrote, and maintain, the Yacc grammar file in TXR Lisp in this style (just the actions in the grammar portion). For whatever reason, it works well in grammar files. https://www.kylheku.com/cgit/txr/tree/parser.y https://www.kylheku.com/cgit/txr/tree/parser.y
- pasc1878 2y agoBrackets are these () - so lisp {} are braces This is English English