Module Femtolib.Array


module Array: sig .. end


Obvious extensions


val fold_lefti : (int -> 'a -> 'b -> 'a) -> 'a -> 'b array -> 'a
val fold_righti : (int -> 'a -> 'b -> 'b) -> 'a array -> 'b -> 'b
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b array -> 'c array -> 'a
val iter2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> unit
val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
val init_matrix : int -> int -> (int -> int -> 'a) -> 'a array array
val matrix_of_list_list : 'a list list -> 'a array array

Miscellaneous


val nb_distinct : 'a array -> int
Assumes sorted input
val binary : int -> int -> bool array
binary len n is base 2 representation of n, truncated to length len.

n = $\sum (binary n).(i) 2i$

val extremum : ('a -> 'a -> bool) -> 'a array -> 'a
extremum (>) list gives the max of the list.
val swap : 'a array -> int -> int -> unit
swap a i j modify the array a in place, swapping elements at indexes i and j.
val shuffle : ?prng:Random.State.t -> 'a array -> unit
val down_init : int -> (int -> 'a) -> 'a array
Same as Array.init, but begins the initialisation at the end of the array.
val cart : 'a array -> 'b array -> ('a * 'b) array array
Returns the cartesian product of a1 and a2
val (*$) : 'a array -> 'b array -> ('a * 'b) array array
Alias for cart.
val interval : int -> int -> int array
Returns the interval [a..b)
val (-|) : int -> int -> int array
Alias for interval.