I don’t think this one is a good example.
The following is hardly longer, and much more readable in my view :
List.map ( fun x->2*x+3 ) [1; 2; 3];;
- : int list = [5; 7; 9]
A mathematician newcomer to Ocaml, for example, will immediately understand what
fun x->2*x+3 means, but scratch his head over
( * ) 2 >> (+) 3.
string_of_int >> print_endline saves a few characters compared to
fun i->print_endline(string_of_int i), but this is such a micro-optimization…
In both mathematics and computer science, “pure composition” is rarely encountered over more than two or three terms.
Which is why I don’t think it’s worth a complication in the Pervasives module.