From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA11189 for caml-red; Fri, 4 Aug 2000 19:58:04 +0200 (MET DST) 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 XAA26897 for ; Thu, 3 Aug 2000 23:07:44 +0200 (MET DST) Received: from dopamine.iq.org (dopamine.iq.org [203.4.184.129]) by nez-perce.inria.fr (8.10.0/8.10.0) with ESMTP id e73L7eH02088 for ; Thu, 3 Aug 2000 23:07:41 +0200 (MET DST) Received: by dopamine.iq.org (Postfix, from userid 110) id 8099CFF4C; Thu, 3 Aug 2000 14:10:55 +1000 (EST) To: caml-list@inria.fr Subject: explict vs inexplicit constant parameters Cc: proff@iq.org From: Julian Assange Date: 03 Aug 2000 14:10:54 +1000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: weis@pauillac.inria.fr I often use the following: let findpair e l = let rec find = function | [] -> None | (a,b)::tl -> if a = e then Some b else findpair tl in find l instead of: let findpair e l = let rec find e = function | [] -> None | (a,b)::tl -> if a = e then Some b else findpair e tl in find e l Is ocaml able to generate faster code for the former? Stylistically, I'm not sure whether these constructs are a good thing or not. Symbolic brevity makes makes it easier to read for small contexts. On the other hand for larger contexts, the de-localisation of variables makes the whole thing harder to follow and dangerous to re-order. Cheers, Julian.