caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Eric Cooper <ecc@cmu.edu>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Having '<<', why to use '|>' ?
Date: Mon, 17 Sep 2007 14:59:11 -0400	[thread overview]
Message-ID: <20070917185911.GB21078@stratocaster.home> (raw)
In-Reply-To: <20070917163617.0e6e0e7c@localhost.localdomain>

On Mon, Sep 17, 2007 at 04:36:17PM +0200, Fabrice Marchant wrote:
> let ( << ) f g x = f (g x)
> let ( |> ) x f = f x
> I usually use '<<' and wonder if we can always supersede '|>' by
> this operator ?  Does it exists a case where the use of '|>' is
> better ?

I think it's just a matter of style.  Your |> operator lets you write
"pipelines" similar to the Unix shell, in which evaluation flows
from left to right.  I've typically used this when I'm applying the
function to all its arguments.  I tend to use the traditional
composition operator (your <<), when I'm combining and passing
functional values around.

-- 
Eric Cooper             e c c @ c m u . e d u


  reply	other threads:[~2007-09-17 18:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-17 14:36 Fabrice Marchant
2007-09-17 18:59 ` Eric Cooper [this message]
2007-09-17 19:45   ` [Caml-list] " Fabrice Marchant
2007-09-17 22:24 ` Julien Moutinho
2007-09-18  5:39   ` Fabrice Marchant
2007-09-18  8:53     ` Julien Moutinho
2007-09-18  9:09       ` Julien Moutinho
2007-09-18 14:12       ` Fabrice Marchant
2007-09-18 16:42         ` Jon Harrop
2007-09-18 20:41           ` skaller
2007-09-19 19:49           ` Fabrice Marchant
2007-09-19 21:56             ` Vincent Aravantinos
2007-09-20 13:42             ` Ashish Agarwal
2007-09-20 18:37               ` Gabriel Kerneis
2007-09-21 20:58               ` Harrison, John R
2007-09-21 21:44                 ` Karl Zilles
2007-09-20 14:39 Aaron Bohannon
2007-09-22 15:22 ` Nicolas Pouillard
2007-09-22 15:43   ` Daniel Bünzli
2007-09-22 23:55     ` Christian Stork

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=20070917185911.GB21078@stratocaster.home \
    --to=ecc@cmu.edu \
    --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).