Module Base__.Uniform_array
include Base.Sexpable.S1 with type 'a t := 'a t
val t_of_sexp : (Base.Sexp.t -> 'a) -> Base.Sexp.t -> 'a t
val sexp_of_t : ('a -> Base.Sexp.t) -> 'a t -> Base.Sexp.t
val empty : _ t
val create : len:int -> 'a -> 'a t
val singleton : 'a -> 'a t
val init : int -> f:(int -> 'a) -> 'a t
val length : 'a t -> int
val get : 'a t -> int -> 'a
val unsafe_get : 'a t -> int -> 'a
val set : 'a t -> int -> 'a -> unit
val unsafe_set : 'a t -> int -> 'a -> unit
val swap : _ t -> int -> int -> unit
val unsafe_set_omit_phys_equal_check : 'a t -> int -> 'a -> unit
unsafe_set_omit_phys_equal_check
is likeunsafe_set
, except it doesn't do aphys_equal
check to try to skipcaml_modify
. It is safe to call this even if the values arephys_equal
.
val map : 'a t -> f:('a -> 'b) -> 'b t
val iter : 'a t -> f:('a -> unit) -> unit
val of_array : 'a array -> 'a t
of_array
andto_array
return fresh arrays with the same contents rather than returning a reference to the underlying array.
include Base.Blit.S1 with type 'a t := 'a t
val blit : ('a t, 'a t) Base__.Blit_intf.blit
val blito : ('a t, 'a t) Base__.Blit_intf.blito
val unsafe_blit : ('a t, 'a t) Base__.Blit_intf.blit
val sub : ('a t, 'a t) Base__.Blit_intf.sub
val subo : ('a t, 'a t) Base__.Blit_intf.subo
val copy : 'a t -> 'a t
val unsafe_truncate : _ t -> len:int -> unit
truncate t ~len
shortenst
's length tolen
. It is an error iflen <= 0
orlen > length t
. It's unsafe to truncate in the middle of iteration.
Extra lowlevel and unsafe functions
val unsafe_create_uninitialized : len:int -> _ t
The behavior is undefined if you access an element before setting it.
val create_obj_array : len:int -> Base__.Import.Caml.Obj.t t
New obj array filled with
Obj.repr 0
val unsafe_set_assuming_currently_int : Base__.Import.Caml.Obj.t t -> int -> Base__.Import.Caml.Obj.t -> unit
unsafe_set_assuming_currently_int t i obj
sets indexi
oft
toobj
, but only works correctly if the value there is an immediate, i.e.Caml.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.unsafe_set_int
is similar but does not assume anything about the target.
val unsafe_set_int_assuming_currently_int : Base__.Import.Caml.Obj.t t -> int -> int -> unit
val unsafe_set_int : Base__.Import.Caml.Obj.t t -> int -> int -> unit
val unsafe_clear_if_pointer : Base__.Import.Caml.Obj.t t -> int -> unit
unsafe_clear_if_pointer t i
preventst.(i)
from pointing to anything to prevent space leaks. It does this by settingt.(i)
toCaml.Obj.repr 0
. As a performance hack, it only does this whennot (Caml.Obj.is_int t.(i))
. It is an error to access the cleared index before setting it again.