Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] exception or conditional
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] exception or conditional
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