caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: akay@sharp.co.uk (Andrew Kay)
To: caml-list@inria.fr
Subject: RE: Functional composition operator?
Date: Tue, 8 Dec 1998 18:08:01 GMT	[thread overview]
Message-ID: <199812081808.SAA01875@byrd.sharp.co.uk> (raw)


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 <whitley@cse.buffalo.edu>
> 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




             reply	other threads:[~1998-12-08 18:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-08 18:08 Andrew Kay [this message]
1998-12-08 20:32 ` John Prevost
1998-12-09 16:17 ` Anton Moscal
  -- strict thread matches above, loose matches on Subject: below --
1998-12-09 12:00 Don Syme
1998-12-08 20:09 Don Syme
1998-12-08 19:51 Don Syme
1998-12-08  5:23 John Whitley
1998-12-08 17:02 ` Pierre Weis
1998-12-08 21:52   ` John Harrison
1998-12-09 10:58     ` Pierre Weis
1998-12-09 17:17       ` John Harrison
1998-12-11 13:57         ` Pierre Weis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199812081808.SAA01875@byrd.sharp.co.uk \
    --to=akay@sharp.co.uk \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).