From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 9CF30BB91 for ; Sun, 24 Jul 2005 01:16:48 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6NNGmBm028062 for ; Sun, 24 Jul 2005 01:16:48 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA21308 for ; Sun, 24 Jul 2005 01:16:47 +0200 (MET DST) Received: from wetware.wetware.com (wetware.wetware.com [209.218.58.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6NNGk9q028059 for ; Sun, 24 Jul 2005 01:16:47 +0200 Received: from [69.12.155.90] (helo=[10.0.1.5]) by wetware.wetware.com with esmtp (Exim 4.43) id 1DwTEY-0006pA-6G for caml-list@inria.fr; Sat, 23 Jul 2005 16:16:42 -0700 Mime-Version: 1.0 (Apple Message framework v733) In-Reply-To: References: <200507231218.13166.Stephane.Glondu@crans.org> <200507231250.45778.Stephane.Glondu@crans.org> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: james woodyatt Subject: Re: [Caml-list] How to do this properly with OCaml? Date: Sat, 23 Jul 2005 16:16:41 -0700 To: Ocaml Trade X-Mailer: Apple Mail (2.733) X-Miltered: at concorde with ID 42E2CFE0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42E2CFDE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; woodyatt:01 jhw:01 wetware:01 caml-list:01 ocaml:01 heap:01 bookkeeping:01 posts:01 heap:01 lazy:01 lazy:01 woodyatt:01 jhw:01 wetware:01 2005,:98 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 On 23 Jul 2005, at 13:15, Brian Hurt wrote: > On Sat, 23 Jul 2005, Thomas Fischbacher wrote: >> >> If I duplicate entries to fill up holes, and later on remove a >> legitimate entry whose duplicates fill holes from the heap, I have >> to introduce extra bookkeeping so that the other placeholder >> copies of that entry are replaced as well - otherwise it could not >> be reclaimed by GC. > > I'd be very inclined just to use options- especially since, as > you've mentioned in other posts, the elements you're putting into > the heap are are fairly large and expensive to create. In this > case, the overhead of options is small, relative to the rest of the > data. If they're large and expensive to create, I'd consider using ['a Lazy.t array] instead of ['a array]. When you initialize the array, do it like this: let initArray n = Array.init n (fun _ -> lazy (assert false)) -- j h woodyatt markets are only free to the people who own them.