From: Brian H. <bri...@ql...> - 2003-06-20 22:08:52
|
On Fri, 20 Jun 2003, Eric C. Cooper wrote: > On Fri, Jun 20, 2003 at 03:58:38PM -0500, Brian Hurt wrote: > > Unless I'm missing something (which is possible), there are three possible > > implementations of Dynarray that I can see working: > > > > 1) Have the internal array be a 'a option array, and not a 'a array as it > > is currently. [...] > > 2) Use the null value kludge. [...] > > 3) Write in C, leaving floats unboxed. [...] > > I'm probably missing some essential context, but what is wrong with > the simple approach of using a mutable 'a array that gets replaced > with a bigger one when you try to set an element beyond its current > length? Because then you are allocating a new array- and copying all the elements of the old array- every time you add a new element to the end of the array. So if you add n elements to an empty array, you end up allocating n arrays, and copying n*(n-1)/2 elements. At which point you might as well be using lists and @. Brian |