Module Js.Vector

type 'a t = 'a array
module Js := Js__.Js_internal
val filterInPlace : ('a -> bool) Js.Fn.arity1 -> 'a t -> unit
val empty : 'a t -> unit
val pushBack : 'a -> 'a t -> unit
val copy : 'a t -> 'a t

shallow copy

val memByRef : 'a -> 'a t -> bool
val iter : ('a -> unit) Js.Fn.arity1 -> 'a t -> unit
val iteri : (int -> 'a -> unit) Js.Fn.arity2 -> 'a t -> unit
val toList : 'a t -> 'a list
val map : ('a -> 'b) Js.Fn.arity1 -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) Js.Fn.arity2 -> 'a t -> 'b t
val foldLeft : ('a -> 'b -> 'a) Js.Fn.arity2 -> 'a -> 'b t -> 'a
val foldRight : ('b -> 'a -> 'a) Js.Fn.arity2 -> 'b t -> 'a -> 'a
val length : 'a t -> int

Return the length (number of elements) of the given array.

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) Js.Fn.arity1 -> 'a t
  • parameter n

    size

  • parameter fn

    callback

  • raises RangeError

    when n is negative

val append : 'a -> 'a t -> 'a t

append x a returns a fresh array with x appended to a

val unsafe_get : 'a t -> int -> 'a
val unsafe_set : 'a t -> int -> 'a -> unit