News for hackers. Stuff that matters.
Re:Not Lisp again (2009) by lisper on Friday October 26, 2018 @11:30AM (#18310164)
> the number of parentheses is just mind boggling

There aren't actually more parens in a Lisp program than a program written in a C-like syntax (which is really an algol-like syntax). They just stand out more for two reasons:

1. There is less punctuation in general, so the parens are more obvious. Instead of f(x, y, z) you write (f x y z). Without the commas, the parens stand out because that's all that is left.

2. There is only one kind of parens in Lisp whereas C-like languages use at least three: (), [], and {}, so that makes any particular kind of paren less prominent.

Re:Not Lisp again (2009) by dxhdr on Friday October 26, 2018 @01:27PM (#18311258)
I believe it's purely seeing lines that end with )))))))) that leads the OP's observation ("To me, how Lisp looks is its worst quality--the number of parentheses is just mind boggling"). You don't get that in a C-like syntax. In practice you don't read each individual closing paren to understand the code so it doesn't matter. But it sure looks "scary."
Re:Not Lisp again (2009) by lisper on Friday October 26, 2018 @01:38PM (#18311331)
> You don't get that in a C-like syntax.

No, instead you get something like );}]);) except that that's usually split up over several lines.

BTW, it's pretty easy to tweak Lisp's syntax so that your parens don't get so deeply nested. See

https://github.com/rongarret/tweetnacl/blob/master/ratchet.l...

for an example.

Re:Not Lisp again (2009) by edflsafoiewq on Friday October 26, 2018 @10:47PM (#18314099)
This isn't really true.

1. Other languages have operators which can be written without brackets, x + y vs (+ x y).

2. Precedence rules allow ex. polynomial expressions to be written without brackets, 2 * x + y vs (+ (* 2 x) y).

3. Algol-like let-bindings or monadic-do-style variable-bindings that inject bindings into the containing block (as opposed to Lisp-style let-blocks where the new scope typically corresponds to a new block) use fewer brackets and keep nesting depth smaller.

    # 2 sets of brackets
    fun foo(x, y, z) {
        let w = x + y;
        let u = w + 2*z;
        let v = w - 2*z;
        u * v
    }

    # 13 sets of brackets
    (fun foo (x y z)
        (let ((w (+ x y))
              (u (+ w (* 2 z)))
              (v (- w (* 2 z))))
            (* u v)))
Re:Not Lisp again (2009) by lisper on Saturday October 27, 2018 @02:58AM (#18314656)
It's pretty easy to embed an infix parser in Lisp if that's the only thing standing between you and happiness. e.g.:

http://www.flownet.com/gat/lisp/parcil.lisp

See:

http://www.flownet.com/gat/lisp/djbec.lisp

for some example code that uses this parser. Scroll down about half way and take a look at xpt-add and xpt-double.

Re:Not Lisp again (2009) by edflsafoiewq on Saturday October 27, 2018 @04:03AM (#18314798)
It's even easier to embed a sublanguage that requires two sets of parens to write a list if that's what happens to make you happy.

    ((+ ((* 2 x)) y))
"I have this sublanguage..." is not a very interesting participant in the evidence that Lisp doesn't have lots of parens.
Re:Not Lisp again (2009) by lisper on Saturday October 27, 2018 @12:09PM (#18316343)
I can add arbitrary numbers of parens to your code too. I fail to see the point.
Re:Not Lisp again (2009) by beders on Friday October 26, 2018 @12:18PM (#18310634)
> There is less punctuation in general, so the parens are more obvious. Instead of f(x, y, z) you write (f x y z). Without the commas, the parens stand out because that's all that is left.

Well put, Madam/Sir.

Re:Not Lisp again (2009) by samatman on Friday October 26, 2018 @11:34AM (#18310202)
3. Lisps optimize tail calls, leading to easier and more efficient recursion. This does tend to increase depth of code.

4. The lisp punctuation style closes all levels on a single line, where most C code guidelines close one level per line. This leads to a "thick" chunk of close parens that students of lisp find harder to read at first.