Operators are just functions as soon as you prefix them with "op". So you can treat them like any old function:
Standard ML of New Jersey v110.75 [built: Sat Nov 10 05:28:39 2012]
- op+;
val it = fn : int * int -> int
This means that you can pass them as arguments for functions of a higher order, as well as for any other function.
Note that if you want to get the infix binding for the name, you can do the opposite:
- val op* = String.^;
val * = fn : string * string -> string
- "foo" * "bar";
val it = "foobar" : string
In other words, the only “unusual” thing in infix operations is that they can be magically turned into regular (prefix) names by adding “op”. source
share