Version française
Home     About     Download     Resources     Contact us    
Browse thread
Associativity of new operators
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alessandro Baretta <a.baretta@b...>
Subject: Associativity of new operators
# let (++) = (-);;
val ( ++ ) : int -> int -> int = <fun>
# 10 ++ 4 ++ 6;;
- : int = 0
# let (@@) = (-);;
val ( @@ ) : int -> int -> int = <fun>
# 10 @@ 4 @@ 6;;
- : int = 12

The above toplevel session shows that the associativity of newly defined 
operators depends on the name of the operator itself. Is there a general rule to 
determine the associativity of the operator?

Alex