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 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 42848BC68 for ; Mon, 13 Nov 2006 18:58:47 +0100 (CET) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kADHwiU1031416 for ; Mon, 13 Nov 2006 18:58:46 +0100 Received: from ppp39-78.lns2.syd6.internode.on.net (HELO rosella) ([59.167.39.78]) by ipmail02.adl2.internode.on.net with ESMTP; 14 Nov 2006 04:28:36 +1030 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAB9AWEU7pydO/2dsb2JhbAA X-IronPort-AV: i="4.09,418,1157293800"; d="scan'208"; a="45194014:sNHT22153768" Subject: Re: [Caml-list] Simple idea for making a function infix From: skaller To: Till Varoquaux Cc: Keisuke Nakano , caml-list@inria.fr In-Reply-To: <9d3ec8300611130819q7e13d5f4mb84b9fb1a2ac74ae@mail.gmail.com> References: <1EB857FD-F706-419C-9181-D45DEA88B756@mist.i.u-tokyo.ac.jp> <9d3ec8300611130819q7e13d5f4mb84b9fb1a2ac74ae@mail.gmail.com> Content-Type: text/plain Date: Tue, 14 Nov 2006 04:58:35 +1100 Message-Id: <1163440715.5452.12.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4558B254.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; infix:01 0100,:01 redefining:01 sourceforge:01 wrote:01 precedence:01 caml-list:01 let:03 problem:05 fold:06 definition:07 approach:08 function:08 fun:08 john:09 On Mon, 2006-11-13 at 17:19 +0100, Till Varoquaux wrote: > Hi, > > I don't really understand the point of the */ operator i your > definition. It's fuy ecause I've cosiderig the same problem recetly ad > came dow to this approach ( I'm redefining(@)... oe c ) > > let ( /* ) x y = y x > > and ( */ ) x y = x y The point is precedence: consider only /* then x /* f y means x /* (f y) whereas x /* f */ y means (f x) y Of course x /* f */ y z means f x (y z) but then x + y z also means (+) x (y z) Also you can write x /* g h */ y which means (g h) x y which is kind of cute, eg: [] /* List.fold_left (fun x y -> y::x) */ [1;2;3] -- John Skaller Felix, successor to C++: http://felix.sf.net