tags:

views:

118

answers:

3

I read a book that uses infix, infixr, and infixl in the sample programs. I'm wondering what the differences are. I'm guessing that infixr performs operation from right to left, and vice versa.

+1  A: 

Yes, the r/l indicates the associativity. Without testing I'd assume that infix has normal left associativity.

Svend
A: 

infix defines the operator to be left-associative, infixr defines it to be right-associative. infixl does not exist.

sepp2k
A: 

It depends on the implementation. The SML '97 standard is a little different from SML/NJ and Mlton. You get slightly different behaviour with each in terms of associativity rules and the way expressions are parenthesised depending on priority (the standard is a bit stricter than the implementations).

Nicholas Wilson