diff --git a/dev/containers/CCArray/index.html b/dev/containers/CCArray/index.html index 6062b45e..010205c4 100644 --- a/dev/containers/CCArray/index.html +++ b/dev/containers/CCArray/index.html @@ -1,5 +1,5 @@ -CCArray (containers.CCArray)

Module CCArray

Array utils

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a random_gen = Stdlib.Random.State.t -> 'a
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Arrays

type !'a t = 'a array
val length : 'a array -> int
val get : 'a array -> int -> 'a
val set : 'a array -> int -> 'a -> unit
val make : int -> 'a -> 'a array
val create : int -> 'a -> 'a array
val create_float : int -> float array
val make_float : int -> float array
val init : int -> ( int -> 'a ) -> 'a array
val make_matrix : int -> int -> 'a -> 'a array array
val create_matrix : int -> int -> 'a -> 'a array array
val append : 'a array -> 'a array -> 'a array
val concat : 'a array list -> 'a array
val sub : 'a array -> int -> int -> 'a array
val copy : 'a array -> 'a array
val fill : 'a array -> int -> int -> 'a -> unit
val blit : 'a array -> int -> 'a array -> int -> int -> unit
val to_list : 'a array -> 'a list
val of_list : 'a list -> 'a array
val iter : ( 'a -> unit ) -> 'a array -> unit
val iteri : ( int -> 'a -> unit ) -> 'a array -> unit
val map : ( 'a -> 'b ) -> 'a array -> 'b array
val mapi : ( int -> 'a -> 'b ) -> 'a array -> 'b array
val fold_left : ( 'a -> 'b -> 'a ) -> 'a -> 'b array -> 'a
val fold_left_map : ( 'a -> 'b -> 'a * 'c ) -> 'a -> 'b array -> 'a * 'c array
val fold_right : ( 'b -> 'a -> 'a ) -> 'b array -> 'a -> 'a
val iter2 : ( 'a -> 'b -> unit ) -> 'a array -> 'b array -> unit
val map2 : ( 'a -> 'b -> 'c ) -> 'a array -> 'b array -> 'c array
val for_all : ( 'a -> bool ) -> 'a array -> bool
val exists : ( 'a -> bool ) -> 'a array -> bool
val memq : 'a -> 'a array -> bool
val find_opt : ( 'a -> bool ) -> 'a array -> 'a option
val split : ('a * 'b) array -> 'a array * 'b array
val combine : 'a array -> 'b array -> ('a * 'b) array
val sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val stable_sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val fast_sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val to_seqi : 'a array -> (int * 'a) Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a array
val unsafe_get : 'a array -> int -> 'a
val unsafe_set : 'a array -> int -> 'a -> unit
module Floatarray : sig ... end
val empty : 'a t

empty is the empty array, physically equal to [||].

val equal : 'a equal -> 'a t equal

equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.

val compare : 'a ord -> 'a t ord

compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.

val swap : 'a t -> int -> int -> unit

swap a i j swaps elements at indices i and j.

  • since 1.4
val get_safe : 'a t -> int -> 'a option

get_safe a i returns Some a.(i) if i is a valid index.

  • since 0.18
val map_inplace : ( 'a -> 'a ) -> 'a t -> unit

map_inplace f a replace all elements of a by its image by f.

val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a

fold f init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as Array.fold_left

val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'a

foldi f init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.

val fold_while : ( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> 'a -> 'b t -> 'a

fold_while f init a folds left on array a until a stop condition via ('a, `Stop) is indicated by the accumulator.

  • since 0.8
val fold_map : ( 'acc -> 'a -> 'acc * 'b ) -> 'acc -> 'a t -> 'acc * 'b t

fold_map f init a is a fold_left-like function, but it also maps the array to another array.

  • since 1.2, but only
  • since 2.1 with labels
val scan_left : ( 'acc -> 'a -> 'acc ) -> 'acc -> 'a t -> 'acc t

scan_left f init a returns the array [|init; f init x0; f (f init a.(0)) a.(1); …|] .

  • since 1.2, but only
  • since 2.1 with labels
val reverse_in_place : 'a t -> unit

reverse_in_place a reverses the array a in place.

val sorted : ( 'a -> 'a -> int ) -> 'a t -> 'a array

sorted f a makes a copy of a and sorts it with f.

  • since 1.0
val sort_indices : ( 'a -> 'a -> int ) -> 'a t -> int array

sort_indices f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of sorted f a appears in a. a is not modified.

In other words, map (fun i -> a.(i)) (sort_indices f a) = sorted f a. sort_indices yields the inverse permutation of sort_ranking.

  • since 1.0
val sort_ranking : ( 'a -> 'a -> int ) -> 'a t -> int array

sort_ranking f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of a appears in sorted f a. a is not modified.

In other words, map (fun i -> (sorted f a).(i)) (sort_ranking f a) = a. sort_ranking yields the inverse permutation of sort_indices.

In the absence of duplicate elements in a, we also have lookup_exn a.(i) (sorted a) = (sorted_ranking a).(i).

  • since 1.0
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> bool

mem ~eq x a return true if x is present in a. Linear time.

  • since 3.0
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b option

find_map f a returns Some y if there is an element x such that f x = Some y. Otherwise returns None.

  • since 1.3, but only
  • since 2.1 with labels
val find_map_i : ( int -> 'a -> 'b option ) -> 'a t -> 'b option

find_map_i f a is like find_map, but the index of the element is also passed to the predicate function f.

  • since 1.3, but only
  • since 2.1 with labels
val find_idx : ( 'a -> bool ) -> 'a t -> (int * 'a) option

find_idx f a returns Some (i,x) where x is the i-th element of a, and f x holds. Otherwise returns None.

  • since 0.3.4
val lookup : cmp:'a ord -> 'a -> 'a t -> int option

lookup ~cmp key a lookups the index of some key key in a sorted array a. Undefined behavior if the array a is not sorted wrt ~cmp. Complexity: O(log (n)) (dichotomic search).

  • returns

    None if the key key is not present, or Some i (i the index of the key) otherwise.

val lookup_exn : cmp:'a ord -> 'a -> 'a t -> int

lookup_exn ~cmp key a is like lookup, but

  • raises Not_found

    if the key key is not present.

val bsearch : +CCArray (containers.CCArray)

Module CCArray

Array utils

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a random_gen = Stdlib.Random.State.t -> 'a
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Arrays

type !'a t = 'a array
val length : 'a array -> int
val get : 'a array -> int -> 'a
val set : 'a array -> int -> 'a -> unit
val make : int -> 'a -> 'a array
val create : int -> 'a -> 'a array
val create_float : int -> float array
val make_float : int -> float array
val init : int -> ( int -> 'a ) -> 'a array
val make_matrix : int -> int -> 'a -> 'a array array
val create_matrix : int -> int -> 'a -> 'a array array
val append : 'a array -> 'a array -> 'a array
val concat : 'a array list -> 'a array
val sub : 'a array -> int -> int -> 'a array
val copy : 'a array -> 'a array
val fill : 'a array -> int -> int -> 'a -> unit
val blit : 'a array -> int -> 'a array -> int -> int -> unit
val to_list : 'a array -> 'a list
val of_list : 'a list -> 'a array
val iter : ( 'a -> unit ) -> 'a array -> unit
val iteri : ( int -> 'a -> unit ) -> 'a array -> unit
val map : ( 'a -> 'b ) -> 'a array -> 'b array
val mapi : ( int -> 'a -> 'b ) -> 'a array -> 'b array
val fold_left : ( 'a -> 'b -> 'a ) -> 'a -> 'b array -> 'a
val fold_left_map : ( 'a -> 'b -> 'a * 'c ) -> 'a -> 'b array -> 'a * 'c array
val fold_right : ( 'b -> 'a -> 'a ) -> 'b array -> 'a -> 'a
val iter2 : ( 'a -> 'b -> unit ) -> 'a array -> 'b array -> unit
val map2 : ( 'a -> 'b -> 'c ) -> 'a array -> 'b array -> 'c array
val for_all : ( 'a -> bool ) -> 'a array -> bool
val exists : ( 'a -> bool ) -> 'a array -> bool
val memq : 'a -> 'a array -> bool
val find_opt : ( 'a -> bool ) -> 'a array -> 'a option
val split : ('a * 'b) array -> 'a array * 'b array
val combine : 'a array -> 'b array -> ('a * 'b) array
val sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val stable_sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val fast_sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val to_seqi : 'a array -> (int * 'a) Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a array
val unsafe_get : 'a array -> int -> 'a
val unsafe_set : 'a array -> int -> 'a -> unit
module Floatarray : sig ... end
val empty : 'a t

empty is the empty array, physically equal to [||].

val equal : 'a equal -> 'a t equal

equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.

val compare : 'a ord -> 'a t ord

compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.

val swap : 'a t -> int -> int -> unit

swap a i j swaps elements at indices i and j.

  • since 1.4
val get_safe : 'a t -> int -> 'a option

get_safe a i returns Some a.(i) if i is a valid index.

  • since 0.18
val map_inplace : ( 'a -> 'a ) -> 'a t -> unit

map_inplace f a replace all elements of a by its image by f.

  • since NEXT_RELEASE
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a

fold f init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as Array.fold_left

val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'a

foldi f init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.

val fold_while : ( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> 'a -> 'b t -> 'a

fold_while f init a folds left on array a until a stop condition via ('a, `Stop) is indicated by the accumulator.

  • since 0.8
val fold_map : ( 'acc -> 'a -> 'acc * 'b ) -> 'acc -> 'a t -> 'acc * 'b t

fold_map f init a is a fold_left-like function, but it also maps the array to another array.

  • since 1.2, but only
  • since 2.1 with labels
val scan_left : ( 'acc -> 'a -> 'acc ) -> 'acc -> 'a t -> 'acc t

scan_left f init a returns the array [|init; f init x0; f (f init a.(0)) a.(1); …|] .

  • since 1.2, but only
  • since 2.1 with labels
val reverse_in_place : 'a t -> unit

reverse_in_place a reverses the array a in place.

val sorted : ( 'a -> 'a -> int ) -> 'a t -> 'a array

sorted f a makes a copy of a and sorts it with f.

  • since 1.0
val sort_indices : ( 'a -> 'a -> int ) -> 'a t -> int array

sort_indices f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of sorted f a appears in a. a is not modified.

In other words, map (fun i -> a.(i)) (sort_indices f a) = sorted f a. sort_indices yields the inverse permutation of sort_ranking.

  • since 1.0
val sort_ranking : ( 'a -> 'a -> int ) -> 'a t -> int array

sort_ranking f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of a appears in sorted f a. a is not modified.

In other words, map (fun i -> (sorted f a).(i)) (sort_ranking f a) = a. sort_ranking yields the inverse permutation of sort_indices.

In the absence of duplicate elements in a, we also have lookup_exn a.(i) (sorted a) = (sorted_ranking a).(i).

  • since 1.0
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> bool

mem ~eq x a return true if x is present in a. Linear time.

  • since 3.0
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b option

find_map f a returns Some y if there is an element x such that f x = Some y. Otherwise returns None.

  • since 1.3, but only
  • since 2.1 with labels
val find_map_i : ( int -> 'a -> 'b option ) -> 'a t -> 'b option

find_map_i f a is like find_map, but the index of the element is also passed to the predicate function f.

  • since 1.3, but only
  • since 2.1 with labels
val find_idx : ( 'a -> bool ) -> 'a t -> (int * 'a) option

find_idx f a returns Some (i,x) where x is the i-th element of a, and f x holds. Otherwise returns None.

  • since 0.3.4
val lookup : cmp:'a ord -> 'a -> 'a t -> int option

lookup ~cmp key a lookups the index of some key key in a sorted array a. Undefined behavior if the array a is not sorted wrt ~cmp. Complexity: O(log (n)) (dichotomic search).

  • returns

    None if the key key is not present, or Some i (i the index of the key) otherwise.

val lookup_exn : cmp:'a ord -> 'a -> 'a t -> int

lookup_exn ~cmp key a is like lookup, but

  • raises Not_found

    if the key key is not present.

val bsearch : cmp:( 'a -> 'a -> int ) -> 'a -> 'a t -> diff --git a/dev/containers/CCArrayLabels/index.html b/dev/containers/CCArrayLabels/index.html index e49bab23..9b24a8d5 100644 --- a/dev/containers/CCArrayLabels/index.html +++ b/dev/containers/CCArrayLabels/index.html @@ -9,7 +9,7 @@ f:( 'a -> 'b -> 'a * 'c ) -> init:'a -> 'b array -> - 'a * 'c array
val fold_right : f:( 'b -> 'a -> 'a ) -> 'b array -> init:'a -> 'a
val for_all : f:( 'a -> bool ) -> 'a array -> bool
val exists : f:( 'a -> bool ) -> 'a array -> bool
val memq : 'a -> set:'a array -> bool
val find_opt : f:( 'a -> bool ) -> 'a array -> 'a option
val split : ('a * 'b) array -> 'a array * 'b array
val combine : 'a array -> 'b array -> ('a * 'b) array
val sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val stable_sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val fast_sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val to_seqi : 'a array -> (int * 'a) Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a array
val unsafe_get : 'a array -> int -> 'a
val unsafe_set : 'a array -> int -> 'a -> unit
module Floatarray : sig ... end
val empty : 'a t

empty is the empty array, physically equal to [||].

val equal : 'a equal -> 'a t equal

equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.

val compare : 'a ord -> 'a t ord

compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.

val swap : 'a t -> int -> int -> unit

swap a i j swaps elements at indices i and j.

  • since 1.4
val get_safe : 'a t -> int -> 'a option

get_safe a i returns Some a.(i) if i is a valid index.

  • since 0.18
val map_inplace : f:( 'a -> 'a ) -> 'a t -> unit

map_inplace ~f a replace all elements of a by its image by f.

val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'a

fold ~f ~init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as ArrayLabels.fold_left

val foldi : f:( 'a -> int -> 'b -> 'a ) -> init:'a -> 'b t -> 'a

foldi ~f ~init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.

val fold_while : + 'a * 'c array
val fold_right : f:( 'b -> 'a -> 'a ) -> 'b array -> init:'a -> 'a
val for_all : f:( 'a -> bool ) -> 'a array -> bool
val exists : f:( 'a -> bool ) -> 'a array -> bool
val memq : 'a -> set:'a array -> bool
val find_opt : f:( 'a -> bool ) -> 'a array -> 'a option
val split : ('a * 'b) array -> 'a array * 'b array
val combine : 'a array -> 'b array -> ('a * 'b) array
val sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val stable_sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val fast_sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val to_seqi : 'a array -> (int * 'a) Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a array
val unsafe_get : 'a array -> int -> 'a
val unsafe_set : 'a array -> int -> 'a -> unit
module Floatarray : sig ... end
val empty : 'a t

empty is the empty array, physically equal to [||].

val equal : 'a equal -> 'a t equal

equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.

val compare : 'a ord -> 'a t ord

compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.

val swap : 'a t -> int -> int -> unit

swap a i j swaps elements at indices i and j.

  • since 1.4
val get_safe : 'a t -> int -> 'a option

get_safe a i returns Some a.(i) if i is a valid index.

  • since 0.18
val map_inplace : f:( 'a -> 'a ) -> 'a t -> unit

map_inplace ~f a replace all elements of a by its image by f.

  • since NEXT_RELEASE
val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'a

fold ~f ~init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as ArrayLabels.fold_left

val foldi : f:( 'a -> int -> 'b -> 'a ) -> init:'a -> 'b t -> 'a

foldi ~f ~init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.

val fold_while : f:( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> init:'a -> 'b t ->