Hacker News new | ask | show | jobs
by Retra 4151 days ago
>Lisp has weird syntax, but lisp has a reason to have that syntax.

Lisp has that syntax because it provides a uniformity to parsing the language, and that's the same thing Haskell offers .

If I write

    a = b + c
You might as well parse that as `a(=(b(+(c))))` with the appropriate semantics.

In that sense, Haskell is just trying to do something like what Lisp does without all the extra parentheses.

1 comments

That's... actually really neat. So there's no operator precedence?
Yes, there is operator precedence, but it only matters for infix notation. Or rather, function application has highest precedence, so there is no ambiguity using it.

My broader point was that the space is the most common symbol in English because the function that it performs is the most fundamental action of the language. And since Haskell is a functional language, function application is fundamental, and thus you gain a lot of terseness by using spaces to denote it.

Lisp does the same thing: `(+ a b)`, it just puts parentheses around things to make the parsing rules simpler. If you parse it in a different way, you won't need that many parentheses.