difference between infix, infixr, infixl
-
26-09-2019 - |
문제
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.
해결책
Yes, the r/l indicates the associativity. Without testing I'd assume that infix
has normal left associativity.
다른 팁
infix
defines the operator to be left-associative, infixr
defines it to be right-associative. infixl
does not exist.
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).
제휴하지 않습니다 StackOverflow