caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yaron Minsky <yminsky@gmail.com>
To: Arlen Christian Mart Cuss <arlen@noblesamurai.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Infix function composition operator
Date: Tue, 9 Nov 2010 22:45:03 -0500	[thread overview]
Message-ID: <AANLkTin2Zwrd7Dn_5MLMBqy4X4ui41g8zg18Y5DkGW-r@mail.gmail.com> (raw)
In-Reply-To: <1289359172.2282.15.camel@azayaka>

[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]

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.

y

On Tue, Nov 9, 2010 at 10:19 PM, Arlen Christian Mart Cuss <
arlen@noblesamurai.com> 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]
>
> http://webcache.googleusercontent.com/search?q=cache:TcqI7o37il8J:pauillac.inria.fr/caml/caml-list/0720.html+ocaml+function+compose&cd=2&hl=en&ct=clnk&client=ubuntu
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 2345 bytes --]

  reply	other threads:[~2010-11-10  3:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10  3:19 Arlen Christian Mart Cuss
2010-11-10  3:45 ` Yaron Minsky [this message]
2010-11-10  4:37   ` [Caml-list] " Arlen Christian Mart Cuss
2010-11-10 10:06   ` DS
2010-11-10 13:23 ` Michael Ekstrand
2010-11-10  6:59 mark
2010-11-10 12:51 ` Jon Harrop
2010-11-14 18:20   ` Till Varoquaux
2010-11-10 13:44 mark
2010-11-10 14:13 ` Jon Harrop
2010-11-10 16:10   ` Stephan Tolksdorf
2010-11-10 17:41     ` Jon Harrop
2010-11-10 18:52       ` Stephan Tolksdorf
2010-11-10 15:18 mark

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=AANLkTin2Zwrd7Dn_5MLMBqy4X4ui41g8zg18Y5DkGW-r@mail.gmail.com \
    --to=yminsky@gmail.com \
    --cc=arlen@noblesamurai.com \
    --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).