function application vs. infix operator precedence
Anoq of the Sun
anoq@HardcoreProcessing.com
Thu, 14 Mar 2002 12:31:47 +0100
Geoffrey G Plitt wrote:
>
> I have made my own infix operator (let's say it's called $) that
> takes an int on the left side, an int->int function on the right
> side, and returns a function int->int.
>
> this works [and is the functionality i am going for]: (1 $ f) 2
> but this doesn't [this is the syntax i want, though]: 1 $ f 2
>
> i guess f is being applied to 2, which i don't want.
>
> so is there a way to make the $ bind with a higher precedence than the
> function application?
As far as I know - function application binds tighter than any
infix operator you can declare. It is one of the tightest precedences
in the SML syntax.
You should be able to add a new infix operator - say app and do the
following:
1 $ f app 2
If you make $ bind more tightly than app it should work as you want. But
I'm not sure if this syntax is OK :)