2 ms·
A long expression containing multiple nested parentheses is no easier to think about in syntaxful languages. Re parens: Lisp doesn't have more parentheses than
by fulafel 9y ago
A long expression containing multiple nested parentheses is no easier to think about in syntaxful languages. Re parens:
Lisp doesn't have more parentheses than other languages:
(if (validate foo)
(println foo "is the right answer"))
vs
if (foo.validate()) {
console.log(foo, "is the right answer");
}
Unless you consider curly braces special and virtuous, and "(" parens bad.
- CrystalGamma 9y agoRust: if foo.validate() { println!("{} is the right answer", foo); } This has less parentheses (unless you count the placeholder in the format string). Putting the condition in parentheses like C and friends do is redundant if you use braces for the block anyway.
- nocman 9y agoless parentheses, but not less bracket-like characters. If you count parens and curlies, it is exactly the same. Yours has 4 parens and 2 curlies (not including the format string), and the original lisp code has 6 parens.
- junke 9y agoWell, many languages like Ada/Pascal or even SQL try to reduce the number of parentheses/braces. But you can manipulate their AST in Lisp easily; that's what makes working with DSLs easy. (procedure foo ((integer x) (in-out integer y)) (set y (+ 3 x y)))) ;; https://sites.google.com/site/sabraonthehill/postmodern-examples/postmodern-intro-to-s-sql (query (:order-by (:select 'countries.name :from 'countries :where (:= 'name '$1))) "Vietnam")