Tomasz Zielonka tomasz.zielonka at gmail.com
Sat Feb 4 14:53:43 EST 2006

```On Sat, Feb 04, 2006 at 08:37:51PM +0100, Stefan Holdermans wrote:
> Taral wrote:
>
> >I think it's very natural. Everything after the \$, including other \$
> >expressions, is applied to the stuff before the \$. This saves me from
> >a lot of nested parentheses.
>
> To me, (\$) helping me to avoid writing lots of parentheses, makes it
> extremely useful. Actually: except for passing function application
> to higher-order functions, this is the only way I use it. So, I
> always thought parentheses were *the* reason for the right-
> associativity of (\$). Not sure if it really was originally, but, ever
> so, I think it is the best reason.

A left-associative low-precedence application operator can also help
avoid writing parentheses, only in different cases, eg.

f \$\$ x + 1 \$\$ x * x + 2 * x + 1

equals

f (x + 1) (x * x + 2 * x + 1)

But in this case the parentheses don't nest, which may be a reason
why a right-associative version was chosen. (\$) helps to avoid
the case of nesting parentheses. Such nesting is unbounded, for
example you can have chains like this with arbitrary length:

a (b (c (d (e (f x)))))

even if you only have unary functions.

Also, adding or removing a function in such a chain can require
non-local changes, that is you are forced to add or remove a closing
parenthesis on the end of expression.

If you use (\$):

a \$ b \$ c \$ d \$ e \$ f x

you can easily add or remove a function in the chain.

On the other hand, adding new parameters to calls like this

f (x + 1) (y - 1) ...

is very localised.

Best regards
Tomasz

--
I am searching for programmers who are good at least in
(Haskell || ML) && (Linux || FreeBSD || math)
for work in Warsaw, Poland
```