Module Std_internal.Array


module Array: Array

type 'a t = 'a array 
include Binable.S1
include Container.S1
include Sexpable.S1
val get : 'a t -> int -> 'a
val set : 'a t -> int -> 'a -> unit
val unsafe_get : 'a t -> int -> 'a
val unsafe_set : 'a t -> int -> 'a -> unit
val create : int -> 'a -> 'a t
val init : int -> f:(int -> 'a) -> 'a t
val make_matrix : dimx:int -> dimy:int -> 'a -> 'a t t
val append : 'a t -> 'a t -> 'a t
val concat : 'a t list -> 'a t
val sub : 'a t -> pos:int -> len:int -> 'a t
val copy : 'a t -> 'a t
val fill : 'a t -> pos:int -> len:int -> 'a -> unit
val blit : src:'a t ->
src_pos:int -> dst:'a t -> dst_pos:int -> len:int -> unit
val of_list : 'a list -> 'a t
val map : f:('a -> 'b) -> 'a t -> 'b t
val iteri : f:(int -> 'a -> unit) -> 'a t -> unit
val mapi : f:(int -> 'a -> 'b) -> 'a t -> 'b t
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b t -> 'a
val fold_right : f:('a -> 'b -> 'b) -> 'a t -> init:'b -> 'b
val sort : cmp:('a -> 'a -> int) -> 'a t -> unit
val stable_sort : cmp:('a -> 'a -> int) -> 'a t -> unit
val fast_sort : cmp:('a -> 'a -> int) -> 'a t -> unit

---------------------------------------------------------------------- Extensions ----------------------------------------------------------------------
val max_length : int
Array lengths l satisfy 0 <= l < max_length.
val cartesian_product : 'a t -> 'b t -> ('a * 'b) t
val normalize : 'a t -> int -> int
normalize array index returns a new index into the array such that if index is less than zero, the returned index will "wrap around" -- i.e. array.(normalize array (-1)) returns the last element of the array.
val slice : 'a t -> int -> int -> 'a t
slice array start stop returns a fresh array including elements array.(start) through array.(stop-1) with the small tweak that the start and stop positions are normalized and a stop index of 0 means the same thing a stop index of Array.length array. In summary, it's like the slicing in Python or Matlab.
val nget : 'a t -> int -> 'a
Array access with normalized index.
val nset : 'a t -> int -> 'a -> unit
Array modification with normalized index.
val filter_opt : 'a option t -> 'a t
filter_opt array returns a new array where None entries are omitted and Some x entries are replaced with x. Note that this changes the index at which elements will appear.
val filter_map : 'a t -> f:('a -> 'b option) -> 'b t
filter_map ~f array maps f over array and filters None out of the results.
val filter_mapi : 'a t -> f:(int -> 'a -> 'b option) -> 'b t
Same as filter_map but uses Array.mapi.
val map2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c t
val filter : f:('a -> bool) -> 'a t -> 'a t
filter ~f array removes the elements for which f returns false.
val filteri : f:(int -> 'a -> bool) -> 'a t -> 'a t
Like filter except f also receives the index.
val swap : 'a t -> int -> int -> unit
swap arr i j swaps the value at index i with that at index j.
val mem : 'a -> 'a t -> bool
mem el arr returns true iff arr.(i) = el for some i
val rev : 'a t -> unit
rev ar reverses ar in place
val of_list_rev : 'a list -> 'a t
of_list_rev l converts from list then reverses in place
val replace : 'a t -> int -> f:('a -> 'a) -> unit
replace t i ~f = t.(i) <- f (t.(i)).
val replace_all : 'a t -> f:('a -> 'a) -> unit
modifies an array in place -- ar.(i) will be set to f(ar.(i))
val find_exn : 'a t -> f:('a -> bool) -> 'a
find_exn f t returns the first a in t for which f t.(i) is true. It raises Not_found if there is no such a.

findi f ar returns the first index i of ar for which f ar.(i) is true
val findi : 'a t -> f:('a -> bool) -> int option
val findi_exn : 'a t -> f:('a -> bool) -> int
findi_exn f ar returns the first index i of ar for which f ar.(i) is true. It raises Not_found if there is no such element.
val reduce : 'a t -> f:('a -> 'a -> 'a) -> 'a option
reduce f [a1; ...; an] is f (... (f (f a1 a2) a3) ...) an.
val reduce_exn : 'a t -> f:('a -> 'a -> 'a) -> 'a
val permute : ?random_state:Random.State.t -> 'a t -> unit
permute ar randomly permutes ar in place
val combine : 'a t -> 'b t -> ('a * 'b) t
combine ar combines two arrays to an array of pairs.
val split : ('a * 'b) t -> 'a t * 'b t
split ar splits an array of pairs into two arrays of single elements.
val sorted_copy : 'a t -> cmp:('a -> 'a -> int) -> 'a t
sorted_copy ar cmp returns a shallow copy of ar that is sorted. Similar to List.sort
val last : 'a t -> 'a
val empty : unit -> 'a t
empty () creates an empty array
module Infix: sig .. end