English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
RE: Functional composition operator?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1998-12-09 (09:09)
From: Don Syme <dsyme@m...>
Subject: RE: Functional composition operator?

Yes, I chose the same operator, which seems very natural. 


> > is there a consensus for choice of infix composition operator?  
> In the end we settled on >> and << for forward and reverse
> composition respectively, satisfying the equations:
>     (f << g) x = f (g x) = (g >> f) x
> The chevrons give a nice feeling of a data pipeline running from g
> to f in each case.  Since composition is associative (in the absence
> of side effects) we can write (f << g << h << i), which is 
> more elegant
> than (compose (compose (compose f g) h) i), without fear of being
> misunderstood.