From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 83258BC6B for ; Thu, 29 Nov 2007 09:16:08 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJsDTkfAXQInh2dsb2JhbACPRQEBAQgKKQ X-IronPort-AV: E=Sophos;i="4.23,228,1194217200"; d="scan'208";a="6298777" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 29 Nov 2007 09:16:08 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id lAT8G7ie017560 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 29 Nov 2007 09:16:08 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAEoETkfC2fJcnmdsb2JhbACPRQEBAQEHBAYp X-IronPort-AV: E=Sophos;i="4.23,228,1194217200"; d="scan'208";a="4723070" Received: from anchor-post-34.mail.demon.net ([194.217.242.92]) by mail2-smtp-roc.national.inria.fr with ESMTP; 29 Nov 2007 09:16:07 +0100 Received: from orion.metastack.com ([80.177.38.218]) by anchor-post-34.mail.demon.net with esmtp (Exim 4.67) id 1IxeZ5-000HYs-D0 for caml-list@inria.fr; Thu, 29 Nov 2007 08:16:07 +0000 Received: from countertenor (cpc3-cmbg6-0-0-cust100.cmbg.cable.ntl.com [81.101.140.101]) (authenticated bits=0) by orion.metastack.com (8.13.4/8.13.3) with ESMTP id lAT89dLQ027670 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Thu, 29 Nov 2007 08:09:39 GMT From: "David Allsopp" To: References: <200711290053.15443.peng.zang@gmail.com> Subject: RE: [Caml-list] Help with simple ocaml memoization problem Date: Thu, 29 Nov 2007 08:16:02 -0000 Organization: MetaStack Solutions Ltd. Message-ID: <005301c83260$15d1a850$017ca8c0@countertenor> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 In-Reply-To: Thread-Index: AcgyTgafcUidB1diTtW3Q1Qn55KcnQAEVsCQ X-Scanned-By: MIMEDefang 2.63 on 172.16.28.218 X-Miltered: at concorde with ID 474E7547.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 memoization:01 recursion:01 hashtbl:01 hashtbl:01 hash:01 peng:98 peng:98 knocking:98 wrote:01 wrote:01 stack:01 stack:01 typing:01 caml-list:01 On 11/28/07, Evan Klitzke wrote: > On 11/28/07, Peng Zang wrote: > > I don't know how to increase the stack size off the top of my head, but > > in general you want to avoid recursion on the stack anyways. An easy > > way is to... > > Thanks Peng. This is much easier to grok than the code that I > originally wrote! One question that I have is what is the difference > between the Map and Hashtbl modules? From the documentation they look > very similar -- why did you use Hashtbl here rather than Map? Map is often slower (though hash tables potentially waste a lot of space and will be slower if you get lots of collisions, of course) and the functorial interface means that when "knocking" something together it's often tempting to use Hashtbl immediately just to save typing! David