Browse thread
[Caml-list] productivity improvement
[
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: | Oleg <oleg_inconnu@m...> |
| Subject: | [Caml-list] Array.resize ? |
Hi Is there an efficient way in O'Caml to append an element to an array ref? let append_elt r x = r := Array.append !r [| x |];; copies the contents of the whole array in its body, while e.g. C++ vector push_back in most cases won't (memory is reserved in chunks automatically, or it can be reserved manually) IOW it seems strange to me that functions of arrays can change their contents but not their size, while functions of array ref's can do it, but inefficiently. How about Array.resize : 'a array -> int -> unit or at least Array.resize: 'a array ref -> int -> unit ? Thanks Oleg ------------------- 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