Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] const equivalent for mutable types?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-07-31 (17:26)
From: Jon Harrop <jon@j...>
Subject: [Caml-list] Functional arrays
On Saturday 31 July 2004 17:35, skaller wrote:
> On Sat, 2004-07-31 at 23:44, Jon Harrop wrote:
> > Incidentally, does anyone have a functional array implementation (which
> > doesn't suck ;-)?
> Map?

Well, by "array" I mean a container with O(1) random access where "n" is the 
number of elements already in the container. ;-)

Also, I'd like it to "enforce" its size. With a map you could have an element 
missing. Although you may be able to write a balanced binary tree which used 
its depth information to enforce each element being filled. That might be 

Anyway, I'm considering implementing arrays which look functional but which 
use built-in arrays and keep track of "derived" arrays (e.g. subarrays) using 
mutables under the bonnet and lazily re-jig them. I think this could make 
things substantially faster (better asymptotic complexity) in my context but 
I'm entirely unsure of how bad the constant prefactor would be hit.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: