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=1.4 required=5.0 tests=DNS_FROM_RFC_POST autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 3FE2ABC6C for ; Mon, 17 Sep 2007 23:44:39 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AswMAFaS7kZQDPJkYWdsb2JhbACBWIwvFQQEEBc X-IronPort-AV: E=Sophos;i="4.20,266,1186351200"; d="scan'208";a="16333972" Received: from smtp28.orange.fr ([80.12.242.100]) by mail4-smtp-sop.national.inria.fr with ESMTP; 17 Sep 2007 23:45:39 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2807.orange.fr (SMTP Server) with ESMTP id 52E9A8000048 for ; Mon, 17 Sep 2007 23:45:39 +0200 (CEST) Received: from localhost.localdomain (Mix-Lyon-109-1-82.w193-250.abo.wanadoo.fr [193.250.9.82]) by mwinf2807.orange.fr (SMTP Server) with ESMTP id 463538000047 for ; Mon, 17 Sep 2007 23:45:33 +0200 (CEST) X-ME-UUID: 20070917214535287.463538000047@mwinf2807.orange.fr Date: Mon, 17 Sep 2007 21:45:35 +0200 From: Fabrice Marchant To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Having '<<', why to use '|>' ? Message-ID: <20070917214535.709551c4@localhost.localdomain> In-Reply-To: <20070917185911.GB21078@stratocaster.home> References: <20070917163617.0e6e0e7c@localhost.localdomain> <20070917185911.GB21078@stratocaster.home> X-Mailer: Claws Mail 2.10.0 (GTK+ 2.10.13; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; pipelines:01 unix:01 avoids:01 caml-list:01 parentheses:01 functional:02 seems:03 tend:03 parameters:03 let:03 let:03 shell:04 passing:05 style:93 arguments:07 > I think it's just a matter of style. Your |> operator lets you write > "pipelines" similar to the Unix shell, in which evaluation flows > from left to right. I've typically used this when I'm applying the > function to all its arguments. I tend to use the traditional > composition operator (your <<), when I'm combining and passing > functional values around. Thanks a lot ! So I will not add the use of "|>" to my habits. Simply using "<<" will help to keep things simple. Only two or three operators seems very useful to me : This one avoids some parentheses and let the code clear. let ( @ ) f x = f x The composition operator : let ( << ) f g x = f @ g x This one, written like this, is not a true operator, but is very useful to adapt parameters order : let flip f x y = f y x This other one, like "|>", doesn't appear to be essential : let ( >> ) f g = ( << ) g f ( Can't write : let ( >> ) = flip ( << ) instead... ) Please are they other useful operators ? Regards, Fabrice