Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Infix function composition operator
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-11-10 (03:45)
From: Yaron Minsky <yminsky@g...>
Subject: Re: [Caml-list] Infix function composition operator
This is probably a minority opinion, but I have written and read quite a lot
of OCaml code over the years, and I've seen surprisingly few effective uses
of the composition operator.  Somehow, I usually find that code that avoids
it is simpler and easier to read.

I'm not averse to infix operators.  At Jane Street we've found the following
sequencing operator to be highly useful:

let ( |! ) x f = f x

and it is indeed part of the default include in Jane Street's Core library.


On Tue, Nov 9, 2010 at 10:19 PM, Arlen Christian Mart Cuss <> wrote:

> Hi all,
> I know this was asked at least 12 years ago[1], but is there any
> consensus or reason for there not being a "compose" function in standard
> OCaml, nor an infix operator?
> At the moment I tend to "let compose" or "let (<<-) f g x = f (g x)",
> but I wish I didn't have to!
> Thanks,
> Arlen
> [1]
> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports: