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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id A4FF8BBAF for ; Wed, 10 Nov 2010 04:45:05 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiACAIKk2UxKfVI0kGdsb2JhbACUCIYiAYgICBUBAQEBCQkMBxEDH6EuiWAKgg6FEC6IWQEBAwWFRQSBW4J+hX2DU4Rp X-IronPort-AV: E=Sophos;i="4.59,176,1288566000"; d="scan'208";a="77569696" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail4-smtp-sop.national.inria.fr with ESMTP; 10 Nov 2010 04:45:05 +0100 Received: by mail-ww0-f52.google.com with SMTP id 36so222640wwa.9 for ; Tue, 09 Nov 2010 19:45:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:reply-to :in-reply-to:references:date:message-id:subject:from:to:cc :content-type; bh=tWa4/WxM5GAu8NiE5usSvr1oYgCCVxjWnhrQ+GYDsx4=; b=R8kFLPCmvpyDXoNkxl44EDs5ap3/un+iZFyiL1S6dBli6JMtkw4jlpgtX9IPq7BwrG mW5udZM+rdYtd1lgjEDDzuXrCS+rVBCTxMTxUlV7D2lr1/iU+XnMGWL5NKdqtLLeyFKH HU3g4ty+yiXIydzUHc9QGrGaWP+ICGWnT8B/k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=RYoqxePqlWwxbQnQNaUMWSZkiErZxOoh7X+pUB9HkNJr/YBUPcvfNQz1AWz6PPzE4j QE8ZMOFrf6JOVo9GUdEgUioLfh5vgfCSUhD+xJxynUl5dJTlScUyCJNNTzhlpxbYqopv ncmPzTmIPS6IdfEWM2yLfshdnJ20qIw/GljTQ= MIME-Version: 1.0 Received: by 10.227.133.2 with SMTP id d2mr7859210wbt.92.1289360703926; Tue, 09 Nov 2010 19:45:03 -0800 (PST) Received: by 10.227.146.200 with HTTP; Tue, 9 Nov 2010 19:45:03 -0800 (PST) Reply-To: yminsky@gmail.com In-Reply-To: <1289359172.2282.15.camel@azayaka> References: <1289359172.2282.15.camel@azayaka> Date: Tue, 9 Nov 2010 22:45:03 -0500 Message-ID: Subject: Re: [Caml-list] Infix function composition operator From: Yaron Minsky To: Arlen Christian Mart Cuss Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=0016e659f52cbeb2ef0494aaaee5 X-Spam: no; 0.00; infix:01 yaron:01 minsky:01 yminsky:01 ocaml:01 infix:01 ocaml:01 beginner's:01 bug:01 beginner's:01 bug:01 averse:98 arlen:98 mart:98 arlen:98 --0016e659f52cbeb2ef0494aaaee5 Content-Type: text/plain; charset=ISO-8859-1 This is probably a minority opinion, but I have written and read quite a lot of OCaml code over the years, and I've seen surprisingly few effective uses of the composition operator. Somehow, I usually find that code that avoids it is simpler and easier to read. I'm not averse to infix operators. At Jane Street we've found the following sequencing operator to be highly useful: let ( |! ) x f = f x and it is indeed part of the default include in Jane Street's Core library. y On Tue, Nov 9, 2010 at 10:19 PM, Arlen Christian Mart Cuss < arlen@noblesamurai.com> 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! > > Thanks, > Arlen > > [1] > > http://webcache.googleusercontent.com/search?q=cache:TcqI7o37il8J:pauillac.inria.fr/caml/caml-list/0720.html+ocaml+function+compose&cd=2&hl=en&ct=clnk&client=ubuntu > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --0016e659f52cbeb2ef0494aaaee5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This is probably a minority opinion, but I have written and read quite a lo= t of OCaml code over the years, and I've seen surprisingly few effectiv= e uses of the composition operator. =A0Somehow, I usually find that code th= at avoids it is simpler and easier to read.

I'm not averse to infix operators. =A0At Jane Street we&= #39;ve found the following sequencing operator to be highly useful:

let ( |! ) x f =3D f x

and it is= indeed part of the default include in Jane Street's Core library.

y

On Tue, Nov 9, 2010= at 10:19 PM, Arlen Christian Mart Cuss <arlen@noblesamurai.com> 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 s= tandard
OCaml, nor an infix operator?

At the moment I tend to "let compose" or "let (<<-) f = g x =3D f (g x)",
but I wish I didn't have to!

Thanks,
Arlen

[1]
http= ://webcache.googleusercontent.com/search?q=3Dcache:TcqI7o37il8J:pauillac.in= ria.fr/caml/caml-list/0720.html+ocaml+function+compose&cd=3D2&hl=3D= en&ct=3Dclnk&client=3Dubuntu

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--0016e659f52cbeb2ef0494aaaee5--