Module Base.Uniform_arraySource
Same semantics as 'a Array.t, except it's guaranteed that the representation array is not tagged with Double_array_tag, the tag for float arrays.
This means it's safer to use in the presence of Obj.magic, but it's slower than normal Array if you use it with floats.
It can often be faster than Array if you use it with non-floats.
See Base.Array for comments.
val sexp_of_t :
('a : value_or_null). (('a : value_or_null) -> Sexplib0.Sexp.t) ->
('a : value_or_null) Base.Uniform_array.t ->
Sexplib0.Sexp.tval t_of_sexp :
('a : value_or_null). (Sexplib0.Sexp.t -> ('a : value_or_null)) ->
Sexplib0.Sexp.t ->
('a : value_or_null) Base.Uniform_array.tval t_sexp_grammar :
('a : value_or_null). ('a : value_or_null) Sexplib0.Sexp_grammar.t ->
('a : value_or_null) Base.Uniform_array.t Sexplib0.Sexp_grammar.t @@ portableval compare :
('a : value_or_null). (('a : value_or_null) -> ('a : value_or_null) -> int) ->
('a : value_or_null) Base.Uniform_array.t ->
('a : value_or_null) Base.Uniform_array.t ->
intval compare__local :
('a : value_or_null). (('a : value_or_null) @ local ->
('a : value_or_null) @ local ->
int) ->
('a : value_or_null) Base.Uniform_array.t @ local ->
('a : value_or_null) Base.Uniform_array.t @ local ->
intFor obtaining uncontended access to empty from a portable function.
val init :
('a : value_or_null). int ->
f:(int -> 'a) @ local ->
'a Base.Uniform_array.t @@ portableval length :
('a : value_or_null). 'a Base.Uniform_array.t @ local contended ->
int @@ portableval unsafe_get :
('a : value_or_null). 'a Base.Uniform_array.t @ local ->
int ->
'a @@ portableval set :
('a : value_or_null). 'a Base.Uniform_array.t @ local ->
int ->
'a ->
unit @@ portableval unsafe_set :
('a : value_or_null). 'a Base.Uniform_array.t @ local ->
int ->
'a ->
unit @@ portableval swap :
('a : value_or_null). 'a Base.Uniform_array.t @ local ->
int ->
int ->
unit @@ portableval unsafe_set_omit_phys_equal_check :
('a : value_or_null). 'a Base.Uniform_array.t @ local ->
int ->
'a ->
unit @@ portableunsafe_set_omit_phys_equal_check is like unsafe_set, except it doesn't do a phys_equal check to try to skip caml_modify. It is safe to call this even if the values are phys_equal.
val unsafe_set_with_caml_modify :
('a : value_or_null). 'a Base.Uniform_array.t @ local ->
int ->
'a ->
unit @@ portableunsafe_set_with_caml_modify always calls caml_modify before setting and never gets the old value. This is like unsafe_set_omit_phys_equal_check except it doesn't check whether the old value and the value being set are integers to try to skip caml_modify.
val set_with_caml_modify :
('a : value_or_null). 'a Base.Uniform_array.t @ local ->
int ->
'a ->
unit @@ portableSame as unsafe_set_with_caml_modify, but with bounds check.
val map :
('a : value_or_null) ('b : value_or_null). 'a Base.Uniform_array.t ->
f:('a -> 'b) @ local ->
'b Base.Uniform_array.t @@ portableval mapi :
('a : value_or_null) ('b : value_or_null). 'a Base.Uniform_array.t ->
f:(int -> 'a -> 'b) @ local ->
'b Base.Uniform_array.t @@ portableval iter :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:('a -> unit) @ local ->
unit @@ portableval iteri :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:(int -> 'a -> unit) @ local ->
unit @@ portableLike iter, but the function is applied to the index of the element as first argument, and the element itself as second argument.
val fold :
('a : value_or_null) 'acc. 'a Base.Uniform_array.t ->
init:'acc ->
f:('acc -> 'a -> 'acc) @ local ->
'acc @@ portableval foldi :
('a : value_or_null) 'acc. 'a Base.Uniform_array.t ->
init:'acc ->
f:(int -> 'acc -> 'a -> 'acc) @ local ->
'acc @@ portableval unsafe_to_array_inplace__promise_not_a_float :
'a Base.Uniform_array.t ->
'a array @@ portableunsafe_to_array_inplace__promise_not_a_float converts from a t to an array in place. This function is unsafe if the underlying type is a float.
of_array and to_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 Base.Uniform_array.t
val blit :
src:'a Base.Uniform_array.t @ local ->
src_pos:int ->
dst:'a Base.Uniform_array.t @ local ->
dst_pos:int ->
len:int ->
unitval blito :
src:'a Base.Uniform_array.t @ local ->
?src_pos:int ->
?src_len:int ->
dst:'a Base.Uniform_array.t @ local ->
?dst_pos:int ->
unit ->
unitval unsafe_blit :
src:'a Base.Uniform_array.t @ local ->
src_pos:int ->
dst:'a Base.Uniform_array.t @ local ->
dst_pos:int ->
len:int ->
unitval sub :
'a Base.Uniform_array.t @ local ->
pos:int ->
len:int ->
'a Base.Uniform_array.tval subo :
?pos:int ->
?len:int ->
'a Base.Uniform_array.t @ local ->
'a Base.Uniform_array.tval copy :
('a : value_or_null). 'a Base.Uniform_array.t ->
'a Base.Uniform_array.t @@ portableval exists :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:('a -> bool) @ local ->
bool @@ portableval existsi :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:(int -> 'a -> bool) @ local ->
bool @@ portableval for_all :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:('a -> bool) @ local ->
bool @@ portableval for_alli :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:(int -> 'a -> bool) @ local ->
bool @@ portableval concat :
('a : value_or_null). 'a Base.Uniform_array.t list ->
'a Base.Uniform_array.t @@ portableval concat_map :
('a : value_or_null) ('b : value_or_null). 'a Base.Uniform_array.t ->
f:('a -> 'b Base.Uniform_array.t) @ local ->
'b Base.Uniform_array.t @@ portableval concat_mapi :
('a : value_or_null) ('b : value_or_null). 'a Base.Uniform_array.t ->
f:(int -> 'a -> 'b Base.Uniform_array.t) @ local ->
'b Base.Uniform_array.t @@ portableval partition_map :
('a : value_or_null) 'b 'c. 'a Base.Uniform_array.t ->
f:('a -> ('b, 'c) Base.Either.t) @ local ->
'b Base.Uniform_array.t * 'c Base.Uniform_array.t @@ portableval filter :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:('a -> bool) @ local ->
'a Base.Uniform_array.t @@ portableval filteri :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:(int -> 'a -> bool) @ local ->
'a Base.Uniform_array.t @@ portableval filter_map :
('a : value_or_null) ('b : value_or_null). 'a Base.Uniform_array.t ->
f:('a -> 'b option) @ local ->
'b Base.Uniform_array.t @@ portableval filter_mapi :
('a : value_or_null) ('b : value_or_null). 'a Base.Uniform_array.t ->
f:(int -> 'a -> 'b option) @ local ->
'b Base.Uniform_array.t @@ portableval find :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:('a -> bool) @ local ->
'a option @@ portableval findi :
('a : value_or_null). 'a Base.Uniform_array.t ->
f:(int -> 'a -> bool) @ local ->
(int * 'a) option @@ portableval find_map :
('a : value_or_null) 'b. 'a Base.Uniform_array.t ->
f:('a -> 'b option) @ local ->
'b option @@ portableval find_mapi :
('a : value_or_null) 'b. 'a Base.Uniform_array.t ->
f:(int -> 'a -> 'b option) @ local ->
'b option @@ portableval map2_exn :
('a : value_or_null) ('b : value_or_null) ('c : value_or_null). 'a
Base.Uniform_array.t ->
'b Base.Uniform_array.t ->
f:('a -> 'b -> 'c) @ local ->
'c Base.Uniform_array.t @@ portableFunctions with the 2 suffix raise an exception if the lengths of the two given arrays aren't the same.
val fold2_exn :
('a : value_or_null) ('b : value_or_null) 'acc. 'a Base.Uniform_array.t ->
'b Base.Uniform_array.t ->
init:'acc ->
f:('acc -> 'a -> 'b -> 'acc) @ local ->
'acc @@ portableval min_elt :
'a Base.Uniform_array.t ->
compare:('a -> 'a -> int) @ local ->
'a option @@ portableval max_elt :
'a Base.Uniform_array.t ->
compare:('a -> 'a -> int) @ local ->
'a option @@ portableval sort :
?pos:int ->
?len:int ->
'a Base.Uniform_array.t @ local ->
compare:('a -> 'a -> int) @ local ->
unit @@ portablesort uses constant heap space.
To sort only part of the array, specify pos to be the index to start sorting from and len indicating how many elements to sort.
include Base.Binary_searchable.S1 with type 'a t := 'a Base.Uniform_array.t
See Binary_search.binary_search in binary_search.ml
val binary_search :
?pos:int ->
?len:int ->
'a Base.Uniform_array.t ->
compare:('a -> 'key -> int) @ local ->
[ `Last_strictly_less_than
| `Last_less_than_or_equal_to
| `Last_equal_to
| `First_equal_to
| `First_greater_than_or_equal_to
| `First_strictly_greater_than ] ->
'key ->
int option @ localSee Binary_search.binary_search_segmented in binary_search.ml
val binary_search_segmented :
?pos:int ->
?len:int ->
'a Base.Uniform_array.t ->
segment_of:('a -> [ `Left | `Right ]) @ local ->
[ `Last_on_left | `First_on_right ] ->
int option @ localExtra lowlevel and unsafe functions
val unsafe_create_uninitialized :
('a : value_or_null). len:int ->
'a Base.Uniform_array.t @@ portableThe behavior is undefined if you access an element before setting it.
New obj array filled with Obj.repr 0
val unsafe_set_assuming_currently_int :
Stdlib.Obj.t Base.Uniform_array.t @ local ->
int ->
Stdlib.Obj.t ->
unit @@ portableunsafe_set_assuming_currently_int t i obj sets index i of t to obj, but only works correctly if the value there is an immediate, i.e. Stdlib.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 :
Stdlib.Obj.t Base.Uniform_array.t @ local ->
int ->
int ->
unit @@ portableval unsafe_set_int :
Stdlib.Obj.t Base.Uniform_array.t @ local ->
int ->
int ->
unit @@ portableval unsafe_clear_if_pointer :
Stdlib.Obj.t Base.Uniform_array.t @ local ->
int ->
unit @@ portableunsafe_clear_if_pointer t i prevents t.(i) from pointing to anything to prevent space leaks. It does this by setting t.(i) to Stdlib.Obj.repr 0. As a performance hack, it only does this when not (Stdlib.Obj.is_int t.(i)). It is an error to access the cleared index before setting it again.