module Vector: Js_vector
type'a
t ='a array
val filterInPlace : ('a -> bool [@bs]) -> 'a t -> unit
p
: predicatea
: arrayval empty : 'a t -> unit
val pushBack : 'a -> 'a t -> unit
val copy : 'a t -> 'a t
val memByRef : 'a -> 'a t -> bool
val iter : ('a -> unit [@bs]) -> 'a t -> unit
val iteri : (int -> 'a -> unit [@bs]) -> 'a t -> unit
val ofList : 'a list -> 'a t
val toList : 'a t -> 'a list
val map : ('a -> 'b [@bs]) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b [@bs]) -> 'a t -> 'b t
val foldLeft : ('a -> 'b -> 'a [@bs]) -> 'a -> 'b t -> 'a
val foldRight : ('b -> 'a -> 'a [@bs]) -> 'b t -> 'a -> 'a
val length : 'a t -> int
val get : 'a t -> int -> 'a
Array.get a n
returns the element number n
of array a
.
The first element has number 0.
The last element has number Array.length a - 1
.
You can also write a.(n)
instead of Array.get a n
.
Raise Invalid_argument "index out of bounds"
if n
is outside the range 0 to (Array.length a - 1)
.
val set : 'a t -> int -> 'a -> unit
Array.set a n x
modifies array a
in place, replacing
element number n
with x
.
You can also write a.(n) <- x
instead of Array.set a n x
.
Raise Invalid_argument "index out of bounds"
if n
is outside the range 0 to Array.length a - 1
.
val make : int -> 'a -> 'a t
Array.make n x
returns a fresh array of length n
,
initialized with x
.
All the elements of this new array are initially
physically equal to x
(in the sense of the ==
predicate).
Consequently, if x
is mutable, it is shared among all elements
of the array, and modifying x
through one of the array entries
will modify all other entries at the same time.
Raise Invalid_argument
if n < 0
or n > Sys.max_array_length
.
If the value of x
is a floating-point number, then the maximum
size is only Sys.max_array_length / 2
.
val init : int -> (int -> 'a [@bs]) -> 'a t
RangeError
when n
is negativen
: sizeval append : 'a -> 'a t -> 'a t
append x a
returns a fresh array with x appended to aval unsafe_get : 'a t -> int -> 'a
val unsafe_set : 'a t -> int -> 'a -> unit