caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Fabrice Marchant <fabricemarchant@free.fr>
To: caml-list@inria.fr
Subject: Compose function for multiple parameters ?
Date: Sat, 31 May 2008 09:24:06 +0200	[thread overview]
Message-ID: <20080531092406.093bd147@free.fr> (raw)

  Hi !

Defining a compose operator :

let ( <<- ) f g x = f (g x)

allows to abstract from parameter and to handle functions nicely :

f <<- g

  My question is : 
  What would be the correct way with more parameters ?

I do not see anything satisfactory neither multiplying the operators :
let ( <<<- ) f g x y = f (g x y);;
  (That would quickly lead to an unreadable code.)

nor keeping with a one-parameter 'compose' to synthesize what we need :

(( <<- ) f) <<- g

Imho, the former is even the worst.

It would be cooler to write the later on the basis of :
(( <<- ) (( <<- ) f)) g

with some operator that could be used as an unary op to lighten the writing.

  Please what would be possible to do ?

Fabrice


             reply	other threads:[~2008-05-31  9:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-31  7:24 Fabrice Marchant [this message]
2008-05-31  8:10 ` [Caml-list] " Fabrice Marchant
2008-05-31 11:24   ` Martin Jambon
2008-05-31 16:05     ` Fabrice Marchant
2008-06-01  8:39       ` Florent Monnier
     [not found]     ` <20080531180149.04e6ac5e@free.fr>
2008-05-31 21:37       ` Martin Jambon
2008-06-01  0:04         ` Robert Fischer
2008-06-01  5:24           ` Fabrice Marchant
2008-06-01  6:16         ` Fabrice Marchant

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=20080531092406.093bd147@free.fr \
    --to=fabricemarchant@free.fr \
    --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).