From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA13842 for caml-redistribution; Wed, 9 Dec 1998 10:09:41 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA29062 for ; Tue, 8 Dec 1998 21:09:58 +0100 (MET) Received: from mail5.microsoft.com (mail5.microsoft.com [131.107.3.121]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id VAA12380; Tue, 8 Dec 1998 21:09:55 +0100 (MET) Received: by INET-IMC-05 with Internet Mail Service (5.5.2232.9) id ; Tue, 8 Dec 1998 12:09:55 -0800 Message-ID: <39ADCF833E74D111A2D700805F1951EF0B2EF6A8@RED-MSG-06> From: Don Syme To: "'Pierre Weis'" , whitley@cse.buffalo.edu Cc: caml-list@inria.fr Subject: RE: Functional composition operator? Date: Tue, 8 Dec 1998 12:09:49 -0800 X-Mailer: Internet Mail Service (5.5.2232.9) Sender: weis > > -- it only save a few characters in programs > (Compare > let h = f o g > with > let h x = f (g x);;) As you say, you can always define the infix identifier, so there's no hassle, i.e. I'm not complaining. However, the comparison should be f1 << f2 << f3 << f4 v. (fun x -> f1(f2(f3(f4 x)))) because we may not be binding the on-the-fly value to a name. Saving parentheses is clearly a good idea - most the ML syntax is directed to this. Even worse consider f1 << f2 x y z << f3 << f4 a b v. (let f4' = f4 a b in let f2' = f2 x y z in (fun x -> f1(f2' z(f3(f4' x))))) since in the latter case we may be taking advantage of the partial evaluation of the closures to, for example, precompute some tables based on the information in x,y,z and a,b. I know which I prefer! In 16,000 lines implementing the interactive theorem prover DECLARE there are 220 uses of composition, so one every 70 lines or so. There are 500 uses of "map", so it's relatively common in that one random example at least. Cheers, Don ------------------------------------------------------------------------ At the lab: At home: Microsoft Research Cambridge 11 John St St George House CB1 1DT Cambridge, CB2 3NH, UK Ph: +44 (0) 1223 744797 Ph: +44 (0) 1223 722244 http://research.microsoft.com/users/dsyme email: dsyme@microsoft.com "You've been chosen as an extra in the movie adaptation of the sequel to your life" -- Pavement, Shady Lane ------------------------------------------------------------------------