module Obj_array:sig..end
Obj.ts.
This is useful to have as its own type because we can implement faster get and set
functions that know that they aren't dealing with double arrays and save a test for
it. We also have set avoid the write barrier (caml_modify) in certain situations.
Just like with a regular Array, the elements are boxed so they don't get copied by
sub, get, set, blit, etc.
type t
include Blit.S
val create : len:int -> tcreate ~len returns an obj-array of length len, all of whose indices have value
Obj.repr 0.val copy : t -> tcopy t returns a new array with the same elements as t.val singleton : Obj.t -> tval empty : tval length : t -> intval get : t -> int -> Obj.tget t i and unsafe_get t i return the object at index i. set t i o and
unsafe_set t i o set index i to o. In no case is the object copied.val unsafe_get : t -> int -> Obj.tval set : t -> int -> Obj.t -> unitval unsafe_set : t -> int -> Obj.t -> unitval unsafe_set_assuming_currently_int : t -> int -> Obj.t -> unitunsafe_set_assuming_currently_int t i obj sets index i of t to obj, but only
works correctly if Obj.is_int (get t i). This precondition saves a dynamic
check.
unsafe_set_int_assuming_currently_int is similar, except the value being set is an
int.
val unsafe_set_int_assuming_currently_int : t -> int -> int -> unitval truncate : t -> len:int -> unittruncate t ~len shortens t's length to len. It is an error if len <= 0 or
len > length t.val sexp_of_t : t -> Sexplib.Sexp.tcreate ~len returns an obj-array of length len, all of whose indices have value
Obj.repr 0.copy t returns a new array with the same elements as t.get t i and unsafe_get t i return the object at index i. set t i o and
unsafe_set t i o set index i to o. In no case is the object copied.unsafe_set_assuming_currently_int t i obj sets index i of t to obj, but only
works correctly if Obj.is_int (get t i). This precondition saves a dynamic
check.
unsafe_set_int_assuming_currently_int is similar, except the value being set is an
int.
truncate t ~len shortens t's length to len. It is an error if len <= 0 or
len > length t.