From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 9A929BBAF for ; Wed, 10 Nov 2010 14:23:53 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApIFAL4r2kyty1O7/2dsb2JhbACDOpB6jgJxrC+Qd4EigzVzBIRaiQkZ X-IronPort-AV: E=Sophos;i="4.59,178,1288566000"; d="scan'208";a="86696858" Received: from elehack.net ([173.203.83.187]) by mail1-smtp-roc.national.inria.fr with ESMTP; 10 Nov 2010 14:23:53 +0100 Received: from [192.168.42.103] (unknown [68.168.162.166]) by elehack.net (Postfix) with ESMTPSA id B6AA1C886B for ; Wed, 10 Nov 2010 07:26:27 -0600 (CST) Message-ID: <4CDA9CE6.1060809@elehack.net> Date: Wed, 10 Nov 2010 07:23:50 -0600 From: Michael Ekstrand User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Infix function composition operator References: <1289359172.2282.15.camel@azayaka> In-Reply-To: <1289359172.2282.15.camel@azayaka> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; infix:01 ocaml:01 infix:01 pervasives:01 arlen:98 mart:98 wrote:01 caml-list:01 module:03 tend:03 std:03 let:03 let:03 consensus:04 extension:06 On 11/09/2010 09:19 PM, Arlen Christian Mart Cuss wrote: > Hi all, > > I know this was asked at least 12 years ago[1], but is there any > consensus or reason for there not being a "compose" function in standard > OCaml, nor an infix operator? > > At the moment I tend to "let compose" or "let (<<-) f g x = f (g x)", > but I wish I didn't have to! Batteries[1] includes such an operator in its Std module and its extension of Pervasives. The compose operator is is '-|', and the reverse compose operator is '|-' ((f |- g) x = g (f x)). It also provides the pipeline operator '|>' and its converse application operator '**>'. - Michael 1. http://batteries.forge.ocamlcore.org