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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4A168BB81 for ; Sat, 1 Oct 2005 20:02:32 +0200 (CEST) Received: from ZIVLNX17.uni-muenster.de (ZIVLNX17.UNI-MUENSTER.DE [128.176.188.79]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j91I2VOD026139 for ; Sat, 1 Oct 2005 20:02:32 +0200 Received: from localhost (localhost [127.0.0.1]) by ZIVLNX17 (Postfix) with ESMTP id 9A856E000D5A; Sat, 1 Oct 2005 20:01:52 +0200 (CEST) Received: from ZIVLNX17.uni-muenster.de ([127.0.0.1]) by localhost (ZIVLNX17 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07583-08; Sat, 1 Oct 2005 20:01:51 +0200 (CEST) Received: from [128.176.151.39] (VPNPOOL01-0285.UNI-MUENSTER.DE [128.176.151.39]) by ZIVLNX17 (Postfix) with ESMTP id A0550E000F0A; Sat, 1 Oct 2005 20:01:50 +0200 (CEST) In-Reply-To: References: <20050926081727.GA9114@coruscant.stwing.upenn.edu> <20050926210730.55850.qmail@web26803.mail.ukl.yahoo.com> <20050930225737.GA592@first.in-berlin.de> <200509301707.01281.pal_engstad@naughtydog.com> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <51b12f38177b34568bfc4e7bea1ffa90@uni-muenster.de> Content-Transfer-Encoding: 7bit Cc: Pal-Kristian Engstad , caml-list@yquem.inria.fr, Oliver Bandel From: Wolfgang Lux Subject: Re: Ant: Re: [Caml-list] Avoiding shared data Date: Sat, 1 Oct 2005 20:02:53 +0200 To: Wolfgang Lux X-Mailer: Apple Mail (2.622) X-Virus-Scanned: by amavisd-new at uni-muenster.de X-Miltered: at concorde with ID 433ECF37.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; wlux:01 uni-muenster:01 caml-list:01 avoiding:01 verbose:01 verbose:01 recursive:01 haskell:01 wrote:01 tail:01 expression:01 functions:01 data:02 parameters:02 wolfgang:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Wolfgang Lux wrote: > let myfunc l = > let g y result = > if ypred y then > let z = verbose_code_using_y y in z_expression :: result > else > result > in let f x result = > if xpred x then > let y = verbose_code_using_x x in g y result > else > result > in fold_right f l [] Just correcting myself. The code should use fold_left rather than fold_right (and thus switch the parameters in the call as well as that of the local functions f and g) because the former is tail recursive and therefore should be preferred in a strict language (have been programming too much Haskell lately where a right fold is better). Wolfghang