From: Michael Ekstrand <michael@elehack.net>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Infix function composition operator
Date: Wed, 10 Nov 2010 07:23:50 -0600 [thread overview]
Message-ID: <4CDA9CE6.1060809@elehack.net> (raw)
In-Reply-To: <1289359172.2282.15.camel@azayaka>
On 11/09/2010 09:19 PM, Arlen Christian Mart Cuss 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!
Batteries[1] includes such an operator in its Std module and its
extension of Pervasives. The compose operator is is '-|', and the
reverse compose operator is '|-' ((f |- g) x = g (f x)). It also
provides the pipeline operator '|>' and its converse application
operator '**>'.
- Michael
1. http://batteries.forge.ocamlcore.org
next prev parent reply other threads:[~2010-11-10 13:23 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 ` [Caml-list] " Yaron Minsky
2010-11-10 4:37 ` Arlen Christian Mart Cuss
2010-11-10 10:06 ` DS
2010-11-10 13:23 ` Michael Ekstrand [this message]
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=4CDA9CE6.1060809@elehack.net \
--to=michael@elehack.net \
--cc=caml-list@yquem.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