Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Functional arrays
On Sun, 2004-08-01 at 03:23, Jon Harrop wrote:
> 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. ;-)

> Anyway, I'm considering implementing arrays which look functional but which 
> use built-in arrays and keep track of "derived" arrays (e.g. subarrays)

Ugg :)

How about a tree of buckets?

This limits copying on modification to one bucket.

When it gets big, you increase the bucket size so
the tree part doesn't grow too much, so you could
amortize the performance between O(1) and O(log n).

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
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