diff --git a/3.10/containers/CCArray/index.html b/3.10/containers/CCArray/index.html index 29c1d6ea..381b18e6 100644 --- a/3.10/containers/CCArray/index.html +++ b/3.10/containers/CCArray/index.html @@ -1,5 +1,5 @@ -
CCArrayArray utils
module Floatarray : sig ... endval empty : 'a tempty is the empty array, physically equal to [||].
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.
compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.
val swap : 'a t -> int -> int -> unitswap a i j swaps elements at indices i and j.
val get_safe : 'a t -> int -> 'a optionget_safe a i returns Some a.(i) if i is a valid index.
val map_inplace : ( 'a -> 'a ) -> 'a t -> unitmap_inplace f a replace all elements of a by its image by f.
val mapi_inplace : ( int -> 'a -> 'a ) -> 'a t -> unitmapi_inplace f a replace all elements of a by its image by f.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'afold 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 -> 'afoldi 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 -> 'afold_while f init a folds left on array a until a stop condition via ('a, `Stop) is indicated by the accumulator.
fold_map f init a is a fold_left-like function, but it also maps the array to another array.
scan_left f init a returns the array [|init; f init x0; f (f init a.(0)) a.(1); …|] .
val reverse_in_place : 'a t -> unitreverse_in_place a reverses the array a in place.
val sorted : ( 'a -> 'a -> int ) -> 'a t -> 'a arraysorted f a makes a copy of a and sorts it with f.
val sort_indices : ( 'a -> 'a -> int ) -> 'a t -> int arraysort_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.
val sort_ranking : ( 'a -> 'a -> int ) -> 'a t -> int arraysort_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).
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> boolmem ~eq x a return true if x is present in a. Linear time.
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b optionfind_map f a returns Some y if there is an element x such that f x = Some y. Otherwise returns None.
val find_map_i : ( int -> 'a -> 'b option ) -> 'a t -> 'b optionfind_map_i f a is like find_map, but the index of the element is also passed to the predicate function f.
val find_idx : ( 'a -> bool ) -> 'a t -> (int * 'a) optionfind_idx f a returns Some (i,x) where x is the i-th element of a, and f x holds. Otherwise returns None.
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).
val bsearch :
+CCArray (containers.CCArray) Module CCArray
Array utils
Arrays
module Floatarray : sig ... endval empty : 'a tempty is the empty array, physically equal to [||].
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.
compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.
val swap : 'a t -> int -> int -> unitswap a i j swaps elements at indices i and j.
val get_safe : 'a t -> int -> 'a optionget_safe a i returns Some a.(i) if i is a valid index.
val map_inplace : ( 'a -> 'a ) -> 'a t -> unitmap_inplace f a replace all elements of a by its image by f.
val mapi_inplace : ( int -> 'a -> 'a ) -> 'a t -> unitmapi_inplace f a replace all elements of a by its image by f.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'afold 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 -> 'afoldi 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 -> 'afold_while f init a folds left on array a until a stop condition via ('a, `Stop) is indicated by the accumulator.
fold_map f init a is a fold_left-like function, but it also maps the array to another array.
scan_left f init a returns the array [|init; f init x0; f (f init a.(0)) a.(1); …|] .
val reverse_in_place : 'a t -> unitreverse_in_place a reverses the array a in place.
val sorted : ( 'a -> 'a -> int ) -> 'a t -> 'a arraysorted f a makes a copy of a and sorts it with f.
val sort_indices : ( 'a -> 'a -> int ) -> 'a t -> int arraysort_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.
val sort_ranking : ( 'a -> 'a -> int ) -> 'a t -> int arraysort_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).
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> boolmem ~eq x a return true if x is present in a. Linear time.
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b optionfind_map f a returns Some y if there is an element x such that f x = Some y. Otherwise returns None.
val find_map_i : ( int -> 'a -> 'b option ) -> 'a t -> 'b optionfind_map_i f a is like find_map, but the index of the element is also passed to the predicate function f.
val find_idx : ( 'a -> bool ) -> 'a t -> (int * 'a) optionfind_idx f a returns Some (i,x) where x is the i-th element of a, and f x holds. Otherwise returns None.
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).
val bsearch :
cmp:( 'a -> 'a -> int ) ->
'a ->
'a t ->
diff --git a/3.10/containers/CCArrayLabels/index.html b/3.10/containers/CCArrayLabels/index.html
index b8d4734c..d5cd7a19 100644
--- a/3.10/containers/CCArrayLabels/index.html
+++ b/3.10/containers/CCArrayLabels/index.html
@@ -9,7 +9,7 @@
f:( 'a -> 'b -> 'a * 'c ) ->
init:'a ->
'b array ->
- 'a * 'c arraymodule Floatarray : sig ... endval empty : 'a tempty is the empty array, physically equal to [||].
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.
compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.
val swap : 'a t -> int -> int -> unitswap a i j swaps elements at indices i and j.
val get_safe : 'a t -> int -> 'a optionget_safe a i returns Some a.(i) if i is a valid index.
val map_inplace : f:( 'a -> 'a ) -> 'a t -> unitmap_inplace ~f a replace all elements of a by its image by f.
val mapi_inplace : f:( int -> 'a -> 'a ) -> 'a t -> unitmapi_inplace ~f a replace all elements of a by its image by f.
val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'afold ~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 -> 'afoldi ~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.
module Floatarray : sig ... endval empty : 'a tempty is the empty array, physically equal to [||].
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.
compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.
val swap : 'a t -> int -> int -> unitswap a i j swaps elements at indices i and j.
val get_safe : 'a t -> int -> 'a optionget_safe a i returns Some a.(i) if i is a valid index.
val map_inplace : f:( 'a -> 'a ) -> 'a t -> unitmap_inplace ~f a replace all elements of a by its image by f.
val mapi_inplace : f:( int -> 'a -> 'a ) -> 'a t -> unitmapi_inplace ~f a replace all elements of a by its image by f.
val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'afold ~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 -> 'afoldi ~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 ->
diff --git a/3.10/containers/CCInt64/index.html b/3.10/containers/CCInt64/index.html
index 9c93c0d8..2cd84225 100644
--- a/3.10/containers/CCInt64/index.html
+++ b/3.10/containers/CCInt64/index.html
@@ -1,2 +1,2 @@
-CCInt64 (containers.CCInt64) Module CCInt64
Helpers for 64-bit integers.
This module provides operations on the type int64 of signed 64-bit integers. Unlike the built-in int type, the type int64 is guaranteed to be exactly 64-bit wide on all platforms. All arithmetic operations over int64 are taken modulo 264.
Performance notice: values of type int64 occupy more memory space than values of type int, and arithmetic operations on int64 are generally slower than those on int. Use int64 only when the application requires exact 64-bit arithmetic.
include module type of struct include Stdlib.Int64 end
val hash : t -> inthash x computes the hash of x, a non-negative integer. Uses FNV since NEXT_RELEASE
val popcount : t -> intNumber of bits set to 1.
val sign : t -> intsign x return 0 if x = 0, -1 if x < 0 and 1 if x > 0. Same as compare x zero.
pow base exponent returns base raised to the power of exponent. pow x y = x^y for positive integers x and y. Raises Invalid_argument if x = y = 0 or y < 0.
floor_div x n is integer division rounding towards negative infinity. It satisfies x = m * floor_div x n + rem x n.
range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. Use a negative step for a decreasing list.
range i j iterates on integers from i to j included . It works both for decreasing and increasing ranges.
range' i j is like range but the second bound j is excluded. For instance range' 0 5 = Iter.of_list [0;1;2;3;4].
val random : t -> t random_genval random_small : t random_genval random_range : t -> t -> t random_genConversion
val of_string : string -> t optionof_string s is the safe version of of_string_exn. Like of_string_exn, but return None instead of raising.
val of_string_exn : string -> tof_string_exn s converts the given string s into a 64-bit integer. Alias to Int64.of_string. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.
The 0u prefix reads the input as an unsigned integer in the range [0, 2*CCInt64.max_int+1]. If the input exceeds CCInt64.max_int it is converted to the signed integer CCInt64.min_int + input - CCInt64.max_int - 1.
The _ (underscore) character can appear anywhere in the string and is ignored. Raise Failure "Int64.of_string" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int64.
val to_string_binary : t -> stringto_string_binary x returns the string representation of the integer x, in binary.
Printing
Infix Operators
Infix operators
module Infix : sig ... endinclude module type of Infix
x / y is the integer quotient of x and y. Integer division. Raise Division_by_zero if the second argument y is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).
x mod y is the integer remainder of x / y. If y <> zero, the result of x mod y satisfies the following properties: zero <= x mod y < abs y and x = ((x / y) * y) + (x mod y). If y = 0, x mod y raises Division_by_zero.
x lsl y shifts x to the left by y bits, filling in with zeroes. The result is unspecified if y < 0 or y >= 64.
x lsr y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 64.
x asr y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 64.
\ No newline at end of file
+CCInt64 (containers.CCInt64) Module CCInt64
Helpers for 64-bit integers.
This module provides operations on the type int64 of signed 64-bit integers. Unlike the built-in int type, the type int64 is guaranteed to be exactly 64-bit wide on all platforms. All arithmetic operations over int64 are taken modulo 264.
Performance notice: values of type int64 occupy more memory space than values of type int, and arithmetic operations on int64 are generally slower than those on int. Use int64 only when the application requires exact 64-bit arithmetic.
include module type of struct include Stdlib.Int64 end
val hash : t -> inthash x computes the hash of x, a non-negative integer. Uses FNV since 3.10
val popcount : t -> intNumber of bits set to 1.
val sign : t -> intsign x return 0 if x = 0, -1 if x < 0 and 1 if x > 0. Same as compare x zero.
pow base exponent returns base raised to the power of exponent. pow x y = x^y for positive integers x and y. Raises Invalid_argument if x = y = 0 or y < 0.
floor_div x n is integer division rounding towards negative infinity. It satisfies x = m * floor_div x n + rem x n.
range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. Use a negative step for a decreasing list.
range i j iterates on integers from i to j included . It works both for decreasing and increasing ranges.
range' i j is like range but the second bound j is excluded. For instance range' 0 5 = Iter.of_list [0;1;2;3;4].
val random : t -> t random_genval random_small : t random_genval random_range : t -> t -> t random_genConversion
val of_string : string -> t optionof_string s is the safe version of of_string_exn. Like of_string_exn, but return None instead of raising.
val of_string_exn : string -> tof_string_exn s converts the given string s into a 64-bit integer. Alias to Int64.of_string. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.
The 0u prefix reads the input as an unsigned integer in the range [0, 2*CCInt64.max_int+1]. If the input exceeds CCInt64.max_int it is converted to the signed integer CCInt64.min_int + input - CCInt64.max_int - 1.
The _ (underscore) character can appear anywhere in the string and is ignored. Raise Failure "Int64.of_string" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int64.
val to_string_binary : t -> stringto_string_binary x returns the string representation of the integer x, in binary.
Printing
Infix Operators
Infix operators
module Infix : sig ... endinclude module type of Infix
x / y is the integer quotient of x and y. Integer division. Raise Division_by_zero if the second argument y is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).
x mod y is the integer remainder of x / y. If y <> zero, the result of x mod y satisfies the following properties: zero <= x mod y < abs y and x = ((x / y) * y) + (x mod y). If y = 0, x mod y raises Division_by_zero.
x lsl y shifts x to the left by y bits, filling in with zeroes. The result is unspecified if y < 0 or y >= 64.
x lsr y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 64.
x asr y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 64.
\ No newline at end of file
diff --git a/3.10/containers/CCRef/index.html b/3.10/containers/CCRef/index.html
index a4b1dcc1..04d416e5 100644
--- a/3.10/containers/CCRef/index.html
+++ b/3.10/containers/CCRef/index.html
@@ -1,2 +1,2 @@
-CCRef (containers.CCRef) Module CCRef
Helpers for references
val create : 'a -> 'a tAlias to ref.
val iter : ( 'a -> unit ) -> 'a t -> unitCall the function on the content of the reference.
val update : ( 'a -> 'a ) -> 'a t -> unitUpdate the reference's content with the given function.
val incr_then_get : int t -> intincr_then_get r increments r and returns its new value, think ++r.
val get_then_incr : int t -> intget_then_incr r increments r and returns its old value, think r++.
val protect : 'a t -> 'a -> ( unit -> 'b ) -> 'bprotect r x f sets r := x; calls f(); restores r to its old value; and returns the result of f().
val to_list : 'a t -> 'a list
\ No newline at end of file
+CCRef (containers.CCRef) Module CCRef
Helpers for references
val create : 'a -> 'a tAlias to ref.
val iter : ( 'a -> unit ) -> 'a t -> unitCall the function on the content of the reference.
val update : ( 'a -> 'a ) -> 'a t -> unitUpdate the reference's content with the given function.
val incr_then_get : int t -> intincr_then_get r increments r and returns its new value, think ++r.
val get_then_incr : int t -> intget_then_incr r increments r and returns its old value, think r++.
val protect : 'a t -> 'a -> ( unit -> 'b ) -> 'bprotect r x f sets r := x; calls f(); restores r to its old value; and returns the result of f().
val to_list : 'a t -> 'a list
\ No newline at end of file
diff --git a/3.10/containers/CCSeq/index.html b/3.10/containers/CCSeq/index.html
index d3f85209..6d214f86 100644
--- a/3.10/containers/CCSeq/index.html
+++ b/3.10/containers/CCSeq/index.html
@@ -1,5 +1,5 @@
-CCSeq (containers.CCSeq) Module CCSeq
Helpers for the standard Seq type
See oseq for a richer API.
Basics
val nil : 'a tval empty : 'a tval singleton : 'a -> 'a tval init : int -> ( int -> 'a ) -> 'a tinit n f corresponds to the sequence f 0; f 1; ...; f (n-1).
val repeat : ?n:int -> 'a -> 'a trepeat ~n x repeats x n times then stops. If n is omitted, then x is repeated forever.
val forever : ( unit -> 'a ) -> 'a tforever f corresponds to the infinit sequence containing all the f ().
val iterate : ( 'a -> 'a ) -> 'a -> 'a titerate f a corresponds to the infinit sequence containing a, f a, f (f a), ...]
val unfold : ( 'b -> ('a * 'b) option ) -> 'b -> 'a tunfold f acc calls f acc and:
- if
f acc = Some (x, acc'), yield x, continue with unfold f acc'. - if
f acc = None, stops.
val is_empty : 'a t -> boolis_empty xs checks in the sequence xs is empty
val head : 'a t -> 'a optionHead of the list.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'aFold on values.
val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'afold_lefti f init xs applies f acc i x where acc is the result of the previous computation or init for the first one, i is the index in the sequence (starts at 0) and x is the element of the sequence.
val iter : ( 'a -> unit ) -> 'a t -> unitval iteri : ( int -> 'a -> unit ) -> 'a t -> unitIterate with index (starts at 0).
val length : _ t -> intNumber of elements in the list. Will not terminate if the list if infinite: use (for instance) take to make the list finite if necessary.
Fair product of two (possibly infinite) lists into a new list. Lazy. The first parameter is used to combine each pair of elements.
Alias of product_with.
Specialization of product_with producing tuples.
group eq l groups together consecutive elements that satisfy eq. Lazy. For instance group (=) [1;1;1;2;2;3;3;1] yields [1;1;1]; [2;2]; [3;3]; [1].
uniq eq l returns l but removes consecutive duplicates. Lazy. In other words, if several values that are equal follow one another, only the first of them is kept.
val for_all : ( 'a -> bool ) -> 'a t -> boolfor_all p [a1; ...; an] checks if all elements of the sequence satisfy the predicate p. That is, it returns (p a1) && ... && (p an) for a non-empty list and true if the sequence is empty. It consumes the sequence until it finds an element not satisfying the predicate.
val exists : ( 'a -> bool ) -> 'a t -> boolexists p [a1; ...; an] checks if at least one element of the sequence satisfies the predicate p. That is, it returns (p a1) || ... || (p an) for a non-empty sequence and false if the list is empty. It consumes the sequence until it finds an element satisfying the predicate.
val find : ( 'a -> bool ) -> 'a t -> 'a optionfind p [a1; ...; an] return Some ai for the first ai satisfying the predicate p and return None otherwise.
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b optionfind f [a1; ...; an] return Some (f ai) for the first ai such that f ai = Some _ and return None otherwise.
scan f init xs is the sequence containing the intermediate result of fold f init xs.
val range : int -> int -> int tval (--) : int -> int -> int ta -- b is the range of integers containing a and b (therefore, never empty).
val (--^) : int -> int -> int ta -- b is the integer range from a to b, where b is excluded.
Operations on two Collections
Fold on two collections at once. Stop at soon as one of them ends.
Map on two collections at once. Stop as soon as one of the arguments is exhausted.
Iterate on two collections at once. Stop as soon as one of them ends.
Combine elements pairwise. Stop as soon as one of the lists stops.
Misc
Eager sort. Require the iterator to be finite. O(n ln(n)) time and space.
Eager sort that removes duplicate values. Require the iterator to be finite. O(n ln(n)) time and space.
Fair Combinations
Implementations
val return : 'a -> 'a tval pure : 'a -> 'a tInfix version of fair_flat_map.
Infix operators
module Infix : sig ... endmodule type MONAD = sig ... endConversions
val of_list : 'a list -> 'a tval to_list : 'a t -> 'a listGather all values into a list.
val of_array : 'a array -> 'a tIterate on the array.
val to_array : 'a t -> 'a arrayConvert into array.
val of_string : string -> char tIterate on characters.
IO
val pp :
+CCSeq (containers.CCSeq) Module CCSeq
Helpers for the standard Seq type
See oseq for a richer API.
Basics
val nil : 'a tval empty : 'a tval singleton : 'a -> 'a tval init : int -> ( int -> 'a ) -> 'a tinit n f corresponds to the sequence f 0; f 1; ...; f (n-1).
val repeat : ?n:int -> 'a -> 'a trepeat ~n x repeats x n times then stops. If n is omitted, then x is repeated forever.
val forever : ( unit -> 'a ) -> 'a tforever f corresponds to the infinit sequence containing all the f ().
val iterate : ( 'a -> 'a ) -> 'a -> 'a titerate f a corresponds to the infinit sequence containing a, f a, f (f a), ...]
val unfold : ( 'b -> ('a * 'b) option ) -> 'b -> 'a tunfold f acc calls f acc and:
- if
f acc = Some (x, acc'), yield x, continue with unfold f acc'. - if
f acc = None, stops.
val is_empty : 'a t -> boolis_empty xs checks in the sequence xs is empty
val head : 'a t -> 'a optionHead of the list.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'aFold on values.
val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'afold_lefti f init xs applies f acc i x where acc is the result of the previous computation or init for the first one, i is the index in the sequence (starts at 0) and x is the element of the sequence.
val iter : ( 'a -> unit ) -> 'a t -> unitval iteri : ( int -> 'a -> unit ) -> 'a t -> unitIterate with index (starts at 0).
val length : _ t -> intNumber of elements in the list. Will not terminate if the list if infinite: use (for instance) take to make the list finite if necessary.
Fair product of two (possibly infinite) lists into a new list. Lazy. The first parameter is used to combine each pair of elements.
Alias of product_with.
Specialization of product_with producing tuples.
group eq l groups together consecutive elements that satisfy eq. Lazy. For instance group (=) [1;1;1;2;2;3;3;1] yields [1;1;1]; [2;2]; [3;3]; [1].
uniq eq l returns l but removes consecutive duplicates. Lazy. In other words, if several values that are equal follow one another, only the first of them is kept.
val for_all : ( 'a -> bool ) -> 'a t -> boolfor_all p [a1; ...; an] checks if all elements of the sequence satisfy the predicate p. That is, it returns (p a1) && ... && (p an) for a non-empty list and true if the sequence is empty. It consumes the sequence until it finds an element not satisfying the predicate.
val exists : ( 'a -> bool ) -> 'a t -> boolexists p [a1; ...; an] checks if at least one element of the sequence satisfies the predicate p. That is, it returns (p a1) || ... || (p an) for a non-empty sequence and false if the list is empty. It consumes the sequence until it finds an element satisfying the predicate.
val find : ( 'a -> bool ) -> 'a t -> 'a optionfind p [a1; ...; an] return Some ai for the first ai satisfying the predicate p and return None otherwise.
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b optionfind f [a1; ...; an] return Some (f ai) for the first ai such that f ai = Some _ and return None otherwise.
scan f init xs is the sequence containing the intermediate result of fold f init xs.
val range : int -> int -> int tval (--) : int -> int -> int ta -- b is the range of integers containing a and b (therefore, never empty).
val (--^) : int -> int -> int ta -- b is the integer range from a to b, where b is excluded.
Operations on two Collections
Fold on two collections at once. Stop at soon as one of them ends.
Map on two collections at once. Stop as soon as one of the arguments is exhausted.
Iterate on two collections at once. Stop as soon as one of them ends.
Combine elements pairwise. Stop as soon as one of the lists stops.
Misc
Eager sort. Require the iterator to be finite. O(n ln(n)) time and space.
Eager sort that removes duplicate values. Require the iterator to be finite. O(n ln(n)) time and space.
Fair Combinations
Implementations
val return : 'a -> 'a tval pure : 'a -> 'a tInfix version of fair_flat_map.
Infix operators
module Infix : sig ... endmodule type MONAD = sig ... endConversions
val of_list : 'a list -> 'a tval to_list : 'a t -> 'a listGather all values into a list.
val of_array : 'a array -> 'a tIterate on the array.
val to_array : 'a t -> 'a arrayConvert into array.
val of_string : string -> char tIterate on characters.
IO
val pp :
?pp_start:unit printer ->
?pp_stop:unit printer ->
?pp_sep:unit printer ->
diff --git a/3.10/index.html b/3.10/index.html
index 65d73eff..46cc4e1f 100644
--- a/3.10/index.html
+++ b/3.10/index.html
@@ -11,9 +11,9 @@
OCaml package documentation
- - containers 3.9
- - containers-data 3.9
- - containers-thread 3.9
+ - containers 3.10
+ - containers-data 3.10
+ - containers-thread 3.10