module Subarray:Functions for manipulating array subranges.sig..end
i and j that define a
subregion within the array that ranges from element i up to but not including element j.val swap : 'a array -> int -> int -> unitswap a i j swaps the elements at positions i and j of a.
0 <= i < Array.length a0 <= j < Array.length aval rev : 'a array -> int -> int -> unitrev a i j reverses the order of the elements in the range i...j-1.
0 <= i <= j <= Array.length aval set_all : 'a array -> int -> int -> 'a -> unitset_all a i j x sets all the elements in the range i...j-1 to x.
0 <= i <= j <= Array.length aval set_fun : 'a array -> int -> int -> (int -> 'a) -> unitset_fun a i j f sets each element k in the range i...j-1
to f k.
0 <= i <= j <= Array.length aval mem : 'a -> 'a array -> int -> int -> boolmem x a i j is true when there is a k in the range
i...j-1 such that x = a.(k).
0 <= i <= j <= Array.length aval exists : ('a -> bool) -> 'a array -> int -> int -> boolexists p a i j is true when there is a k in the range
i...j-1 such that p a.(k).
0 <= i <= j <= Array.length aval exists_const : ('a -> 'b -> bool) -> 'a -> 'b array -> int -> int -> boolexists_const p x a i j is the same as Subarray.exists (p
x) a i j, only faster because applying closures is slow.val for_all : ('a -> bool) -> 'a array -> int -> int -> boolfor_all p a i j is true when for every k in the range
i...j-1 we have p a.(k).
0 <= i <= j <= Array.length aval for_all_const : ('a -> 'b -> bool) -> 'a -> 'b array -> int -> int -> boolfor_all_const p x a i j is the same as Subarray.for_all (p
x) a i j, only faster because applying closures is slow.val first : ('a -> bool) -> 'a array -> int -> int -> intfirst p v is the index of the first element of a in the
range i...j-1 satisfying p, or j if there is no such
k.
0 <= i <= j <= Array.length aval first_const : ('a -> 'b -> bool) -> 'a -> 'b array -> int -> int -> intfirst_const p x a i j is the same as Subarray.first (p x)
a i j, only faster because applying closures is slow.val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b array -> int -> int -> 'afold_left f l a i j computes
f (... (f (f l a.(i)) a.(i+1)) ...) a.(j-1).
0 <= i <= j <= Array.length aval fold_right : ('a -> 'b -> 'b) -> 'a array -> int -> int -> 'b -> 'bfold_right f a i j r computes
f a.(i) (... (f a.(j-2) (f a.(j-1) r)) ...)
0 <= i <= j <= Array.length aval foldi_left : ('a -> int -> 'b -> 'a) -> 'a -> 'b array -> int -> int -> 'afold_lefti f l a i j computes
f (... (f (f l i a.(i)) (i+1) a.(i+1)) ...) (j-1) a.(j-1).
0 <= i <= j <= Array.length aval foldi_right : (int -> 'a -> 'b -> 'b) -> 'a array -> int -> int -> 'b -> 'bfoldi_right f a i j r computes
f i a.(i) (... (f (j-2) a.(j-2) (f (j-1) a.(j-1) r)) ...)
0 <= i <= j <= Array.length aval fold_left_const : ('a -> 'b -> 'c -> 'b) -> 'a -> 'b -> 'c array -> int -> int -> 'bfold_left_const f x l a i j is Subarray.fold_left (f x) l
a i j, only faster since applying closures is slow.val fold_right_const : ('a -> 'b -> 'c -> 'c) -> 'a -> 'b array -> int -> int -> 'c -> 'cfold_right_const f x a i j r is Subarray.fold_right (f x)
a i j r, only faster since applying closures is slow.val foldi_left_const : ('a -> 'b -> int -> 'c -> 'b) -> 'a -> 'b -> 'c array -> int -> int -> 'bfold_lefti f x l a i j is Subarray.foldi_left (f x) l a i
j, only faster since applying closures is slow.val foldi_right_const : ('a -> int -> 'b -> 'c -> 'c) -> 'a -> 'b array -> int -> int -> 'c -> 'cfoldi_right_const f x a i j r is Subarray.foldi_right (f
x) a i j r, only faster since applying closures is slow.val iter : ('a -> unit) -> 'a array -> int -> int -> unititer c a i j evaluates c a.(k) for each k in the range
i...j-1.
0 <= i <= j <= Array.length aval iteri : (int -> 'a -> unit) -> 'a array -> int -> int -> unititer c a i j evaluates c k a.(k) for each k in the range
i...j-1.
0 <= i <= j <= Array.length aval iter_const : ('a -> 'b -> unit) -> 'a -> 'b array -> int -> int -> unit
val iteri_const : ('a -> int -> 'b -> unit) -> 'a -> 'b array -> int -> int -> unit
val modify : ('a -> 'a) -> 'a array -> int -> int -> unitmodify f a i j sets a.(k) to f a.(k) for each k in the
range i...j-1.
0 <= i <= j <= Array.length aval modify_const : ('a -> 'b -> 'b) -> 'a -> 'b array -> int -> int -> unitmodify_const f x a i j is Subarray.modify (f x) a i j,
only faster because applying closures is slow.val sort : ('a -> 'a -> int) -> 'a array -> int -> int -> unitsort c a i j sorts elements of a in the range i...j-1 in
ascending order as defined by the comparison function c. c x
y returns a negative number if x comes before y, a positive
number if x comes after y and zero if x and y are order
equivalent.
0 <= i <= j <= Array.length aval stable_sort : ('a -> 'a -> int) -> 'a array -> int -> int -> unitstable_sort c a i j sorts elements of a in the range
i...j-1 in ascending order as defined by the comparison
function c. c x y returns a negative number if x comes before
y, a positive number if x comes after y and zero if x and y are
order equivalent.
The sort is stable in that adjacent order equivalent elements remain in their original order.
0 <= i <= j <= Array.length a