Майкл
Майкл

Reputation: 41

What does |> mean in Ocaml?

I was reading some source code and came across |>

I tried googling but it is too hard to google symbols.

I am new to Ocaml, can anyone explain? Please and thank you!

Upvotes: 4

Views: 224

Answers (1)

chepner
chepner

Reputation: 530882

http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#6_Compositionoperators

It is a reverse application operator; the argument goes on the left, the function to apply to the argument on the right.

x |> f = f x

Updated reference page: https://v2.ocaml.org/api/Stdlib.html#1_Compositionoperators

Upvotes: 6

Related Questions