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=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 8FB4FBBAF for ; Sat, 31 May 2008 23:40:12 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoEAABZiQUhCbwQZlGdsb2JhbACSCwEBAQEJAwoHEQSaJQ X-IronPort-AV: E=Sophos;i="4.27,572,1204498800"; d="scan'208";a="13027575" Received: from concorde.inria.fr ([192.93.2.39]) by mail1-smtp-roc.national.inria.fr with ESMTP; 31 May 2008 23:40:12 +0200 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m4VLeCDP025018 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 31 May 2008 23:40:12 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoEAABZiQUhCbwQZlGdsb2JhbACSCwEBAQEJAwoHEQSaJQ X-IronPort-AV: E=Sophos;i="4.27,572,1204498800"; d="scan'208";a="13027574" Received: from out1.smtp.messagingengine.com ([66.111.4.25]) by mail1-smtp-roc.national.inria.fr with ESMTP; 31 May 2008 23:40:11 +0200 Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 21979111749; Sat, 31 May 2008 17:40:10 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Sat, 31 May 2008 17:40:10 -0400 X-Sasl-enc: qETmHJI20+hP7zEBx887h07gAhbaUju23Oxpf6+jB/et 1212270009 Received: from [192.168.1.10] (ALyon-157-1-145-205.w90-42.abo.wanadoo.fr [90.42.152.205]) by mail.messagingengine.com (Postfix) with ESMTPSA id 4447735CA3; Sat, 31 May 2008 17:40:09 -0400 (EDT) Date: Sat, 31 May 2008 23:37:24 +0200 (CEST) From: Martin Jambon X-X-Sender: martin@martin.ec.wink.com To: Fabrice Marchant Cc: caml-list@inria.fr Subject: Re: [Caml-list] Compose function for multiple parameters ? In-Reply-To: <20080531180149.04e6ac5e@free.fr> Message-ID: References: <20080531092406.093bd147@free.fr> <20080531101042.25d046ee@free.fr> <20080531180149.04e6ac5e@free.fr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at concorde with ID 4841C5BC.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 ens-lyon:01 wrote:01 wrote:01 caml-list:01 jambon:01 jambon:01 defining:02 module:03 ops:03 parameters:03 parameters:03 let:03 let:03 identifiers:04 On Sat, 31 May 2008, Fabrice Marchant wrote: > On Sat, 31 May 2008 13:24:55 +0200 (CEST) > Martin Jambon wrote: > >> On Sat, 31 May 2008, Fabrice Marchant wrote: >> >>>> It would be cooler to write the later on the basis of : >>>> (( <<- ) (( <<- ) f)) g >>> >>> Sorry, I just discover that this is cleaner : >>> (( <<- ) <<- ( <<- )) >>> >>> and extendable to any number of parameters. >>> >>> (( <<- ) <<- ( <<- ) <<- ( <<- )) >>> to compose with a 3 parameters function. >> >> Personally, I call this obfuscated, not clean. >> >> >> Martin > > OK, it's far to be perfect - funny at best. But what would be the right way ? > > Defining the 2 ops : > let ( <<- ) f g x = f (g x) > let ( <<-- ) f g x y = f (g x y) > > is it better ? Sorry Fabrice, I'm realizing that my answer was a bit rude... My point is: why do you insist on having such operators? In my experience only the simple composition operator can be useful occasionally, locally. Stuff that is not used frequently or which is used far from its point of definition should receive identifiers that mean something. So what I would do is use no operator at all unless you use it more than 5 times in the same module (more or less). In other words, it's fun to play with such things, but in production code it's not useful except in some very special situations. Martin -- http://wink.com/profile/mjambon http://mjambon.com