From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA07615; Wed, 11 Feb 2004 00:34:40 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 AAA06045 for ; Wed, 11 Feb 2004 00:34:39 +0100 (MET) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i1ANYav22265 for ; Wed, 11 Feb 2004 00:34:37 +0100 (MET) Received: from fichte.ai.univie.ac.at (markus@localhost [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) with ESMTP id i1ANYLHn023977; Wed, 11 Feb 2004 00:34:21 +0100 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i1ANYL4q023976; Wed, 11 Feb 2004 00:34:21 +0100 Date: Wed, 11 Feb 2004 00:34:21 +0100 From: Markus Mottl To: Chris GauthierDickey Cc: caml-list@inria.fr Subject: Re: [Caml-list] exception or conditional Message-ID: <20040210233421.GA23818@fichte.ai.univie.ac.at> Mail-Followup-To: Chris GauthierDickey , caml-list@inria.fr References: <4029641D.5050102@cs.uoregon.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4029641D.5050102@cs.uoregon.edu> User-Agent: Mutt/1.4.1i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dynamically:01 resize:01 resize:01 res-library:01 arrays:01 chris:01 implements:01 ocaml:01 checking:01 mottl:02 mottl:02 exception:02 exception:02 bounds:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 10 Feb 2004, Chris GauthierDickey wrote: > I'm writing a function that is using an array that can be dynamically > resized. I'm wondering if it would be better to just catch an exception > if we attempt to go out of bounds in the array (at which point I resize > the array), or if I should test the size using an if-then-else before I > enter the main body of my function and resize then. You might be interested in the RES-library, which also implements resizable arrays while staying compatible to the Array-module: http://www.oefai.at/~markus/home/ocaml_sources.html#RES Bounds checking probably makes less difference to the performance of your algorithm than you might expect. Regards, Markus -- Markus Mottl http://www.oefai.at/~markus markus@oefai.at ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners