Hacker News new | ask | show | jobs
by dasmoth 3207 days ago
Haskell makes a reasonable job of combining infix operators with no commas between function arguments[1]. You sometimes end up with a few extra parentheses and $s instead, but things generally seem to work out.

Does use commas for lists and tuples, though. The latter kind-of make sense, it's the commas that identify the expression as a tuple. Not sure what the rationale for commas in lists is, though.

[1] Slightly complicated by currying (arguably, it's several successive function applications rather than one multi-arg application) but the end result is the same...

1 comments

> Not sure what the rationale for commas in lists is, though.

Well, you need some separator, and spaces won't do since [x y] has x applied to y.

Good point.

Although could, in principle, make space-between-list-items higher precedence than function application. E.g.:

    [x (func y) z]
But how do you write a list with only one element, x (func y) z?
[(x (func y) z)]