Version française
Home     About     Download     Resources     Contact us    
Browse thread
Compose function for multiple parameters ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Fabrice Marchant <fabricemarchant@f...>
Subject: Compose function for multiple parameters ?
  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