Commit 14e9e620 authored by POTTIER Francois's avatar POTTIER Francois

Added [InfiniteArray.update].

parent cc6c7377
......@@ -42,6 +42,12 @@ let set a i x =
a.table.(i) <- x;
a.extent <- max (i + 1) a.extent
let update a i f =
ensure a i;
let x = a.table.(i) in
a.table.(i) <- f x;
a.extent <- max (i + 1) a.extent
let extent a =
a.extent
......
......@@ -14,6 +14,9 @@ val get: 'a t -> int -> 'a
[a] to [x]. Slots are numbered 0 and up. **)
val set: 'a t -> int -> 'a -> unit
(** [update a i f] is equivalent to [set a i (f (get a i))]. *)
val update: 'a t -> int -> ('a -> 'a) -> unit
(** [extent a] is the length of an initial segment of the array [a]
that is sufficiently large to contain all [set] operations ever
performed. In other words, all elements beyond that segment have
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment