Browse thread
[Caml-list] const equivalent for mutable types?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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 interesting... 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. Cheers, Jon. ------------------- 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