From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 51AFCBC32 for ; Fri, 18 Mar 2005 01:04:11 +0100 (CET) Received: from mail.davidb.org (adsl-64-172-240-129.dsl.sndg02.pacbell.net [64.172.240.129]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j2I04987005753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 18 Mar 2005 01:04:11 +0100 Received: from davidb by mail.davidb.org with local (Exim 4.43 #1 (Debian)) id 1DC4yF-0004Vr-Jy; Thu, 17 Mar 2005 16:04:07 -0800 Date: Thu, 17 Mar 2005 16:04:07 -0800 From: David Brown To: Oliver Bandel Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] tail-recursion vs. no tail-recursion in list functions Message-ID: <20050318000407.GA17278@old.davidb.org> References: <200503161951.48923.jon@ffconsultancy.com> <20050317214113.GC397@first.in-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050317214113.GC397@first.in-berlin.de> User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 423A1AF9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 caml-list:01 oliver:01 bandel:01 imho:01 ...:98 wrote:01 integer:01 functions:01 checking:01 overhead:03 overhead:03 thu:05 introduces:07 sense:08 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: On Thu, Mar 17, 2005 at 10:41:13PM +0100, Oliver Bandel wrote: > IMHO this does not makes sense. > Better checking listlength with List.length and then calling the > needed function directly. > Why using an integer counter... this introduces overhead. List.length is O(n) and will be at least as much overhead as a counter kept for the beginning portion of the list. Dave