From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA08228 for caml-redistribution; Tue, 8 Dec 1998 19:51:46 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA05058 for ; Tue, 8 Dec 1998 19:08:17 +0100 (MET) Received: from hades-sle.sharp.co.uk (hades-sle.sharp.co.uk [193.114.241.3]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id TAA10787 for ; Tue, 8 Dec 1998 19:08:10 +0100 (MET) Received: from sharp.co.uk (inca.sle.sharp.co.uk [192.16.16.3]) by hades-sle.sharp.co.uk (8.8.8+Sun/8.8.8) with SMTP id SAA06410 for ; Tue, 8 Dec 1998 18:01:55 GMT Received: from byrd.sharp.co.uk by sharp.co.uk (SMI-8.6/SMI-SVR4) id SAA19920; Tue, 8 Dec 1998 18:06:38 GMT Received: by byrd.sharp.co.uk (SMI-8.6/SMI-SVR4) id SAA01875; Tue, 8 Dec 1998 18:08:01 GMT Date: Tue, 8 Dec 1998 18:08:01 GMT From: akay@sharp.co.uk (Andrew Kay) Message-Id: <199812081808.SAA01875@byrd.sharp.co.uk> To: caml-list@inria.fr Subject: RE: Functional composition operator? Sender: weis John Whitley raised again a question that I had asked earlier. We were converting source from caml to ocaml, and needed to change our infix operator for function compostion. We found the performance and accuracy of the ocaml compiler (relative to the caml compiler) to be excellent. There were only two teething problems in our 1.2MB of source code, once all the syntax changes had been sorted out with the help of caml2csl, and these were resolved within a day. (Both were to do with questionable code of our own, which probably should not have worked in caml, but which somehow did.) This seems to us to be an amazing achievement of the ocaml development team, and gives us confidence in using and recommending ocaml in the future. From: John Whitley > 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. We're still interested to know if other people have different approaches. Best wishes Andrew Kay -- Sharp Labs Europe Ltd, Oxford Science Park, Oxford, UK, OX4 4GB Andrew.Kay@sharp.co.uk Tel:+44 1865 747711 FAX:+44 1865 747717