Left and right associative operators

In the book Real World OCaml, this section explains a few things about operators.

However, the following code is extremely confusing:

let (|>) x f = f x

and

let (^>) x f = f x

I do not see any difference between these two definitions. How can you tell that the first operator is left associative and the second operator is right associative?

You want this part of the docs: Operators · OCaml Documentation

The first character of an operator dictates its associativity and priority…

There is a linked table showing them.

1 Like

There is a more succinct reference in the standard library OCaml library : Ocaml_operators