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
Having '<<', why to use '|>' ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-09-18 (20:12)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Having '<<', why to use '|>' ?
On Tuesday 18 September 2007 15:12:46 Fabrice Marchant wrote:
> A 3 chars operator (<<<) doesn't look smart.

That is actually the F# for lsl. There are also ||| and &&& for bitwise ops.

> Simpler is better. 
> However, about (@@), I preferred to see the direction of the asymmetric
> composition operator. ( <| ) instead of ( << ) ? Is this a possible idea ?

But "<<" is the converse of ">>" (in F#) and "|>" has no converse (or you 
could say that "x |> f" is the converse of "f x").

>   But maybe your idea is good. Maths use a kind of small 'o' : (f o g) (x)
> = f (g (x)). It's symmetric like (@@), and that doesn't raise any problem.

If an OCaml front-end handled unicode with appropriate symbol settings then 
you could use an "o" symbol to mean that infix operator. I think that is a 
good solution, provided you use an editor that supports suitable unicode and 
there is an easy way to enter such things.

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists