Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Well, 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")


Rust:

    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.


less 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: