To use an infix operator as a prefix function in OCaml, you can put parenthesis around it. for example, 1 + 2
is equivalent to (+) 1 2
.
How do you do the opposite?
For example, in Haskell, a prefix function taking two parameters can be used as an infix operator by wrapping it in backticks. prefixFunction x y
is equivalent to x `prefixFunction` y
. Is there an equivalent in OCaml?
This isn't possible. It's simply not a feature of the language.
See the grammar for infix operators and more specifically of prefix and infix symbols in the OCaml manual.