From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 8BE80BBAF for ; Sat, 31 May 2008 11:16:58 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqcAALa0QEjUGypAmWdsb2JhbACBVZBcAQEBAQEIBQYJEQOVQoVq X-IronPort-AV: E=Sophos;i="4.27,570,1204498800"; d="scan'208";a="11370426" Received: from discorde.inria.fr ([192.93.2.38]) by mail2-smtp-roc.national.inria.fr with ESMTP; 31 May 2008 11:16:58 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m4V9Gwew030200 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 31 May 2008 11:16:58 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqcAALa0QEjUGypAmWdsb2JhbACBVZBcAQEBAQEIBQYJEQOVQoVq X-IronPort-AV: E=Sophos;i="4.27,570,1204498800"; d="scan'208";a="11370425" Received: from smtp7-g19.free.fr ([212.27.42.64]) by mail2-smtp-roc.national.inria.fr with ESMTP; 31 May 2008 11:16:57 +0200 Received: from smtp7-g19.free.fr (localhost [127.0.0.1]) by smtp7-g19.free.fr (Postfix) with ESMTP id 842BE322812 for ; Sat, 31 May 2008 11:16:57 +0200 (CEST) Received: from localhost.localdomain (c5850-a2-3-62-147-11-178.dial.proxad.net [62.147.11.178]) by smtp7-g19.free.fr (Postfix) with ESMTP id 9A0CF3227EC for ; Sat, 31 May 2008 11:16:56 +0200 (CEST) Date: Sat, 31 May 2008 09:24:06 +0200 From: Fabrice Marchant To: caml-list@inria.fr Subject: Compose function for multiple parameters ? Message-ID: <20080531092406.093bd147@free.fr> X-Mailer: Claws Mail 3.2.0 (GTK+ 2.12.9; i486-pc-linux-gnu) X-Face: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 4841178A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; multiplying:01 unreadable:01 synthesize:01 imho:01 abstract:01 functions:01 parameter:02 defining:02 unary:03 parameters:03 parameters:03 let:03 let:03 function:08 fabrice:08 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