From 39b037c85aca011d16b472255a0751fcd41ab488 Mon Sep 17 00:00:00 2001 From: FardaleM Date: Sat, 3 Apr 2021 14:48:18 +0000 Subject: [PATCH] deploy: b2342ead0aa4d9ae968d31a67f618e932b744446 --- dev/containers/CCArrayLabels/index.html | 2 +- dev/containers/CCEither/index.html | 2 +- dev/containers/CCFormat/index.html | 2 +- dev/containers/CCHashtbl/module-type-S/index.html | 2 +- dev/containers/CCList/index.html | 2 +- dev/containers/CCListLabels/index.html | 2 +- dev/containers/CCMap/module-type-S/index.html | 2 +- dev/containers/CCSet/module-type-S/index.html | 2 +- dev/containers/CCShimsArrayLabels_/index.html | 2 +- dev/containers/CCShimsEither_/index.html | 2 +- dev/containers/CCShimsList_/index.html | 2 +- dev/containers/CCString/index.html | 2 +- dev/containers/CCStringLabels/index.html | 2 +- dev/containers/Containers/Hashtbl/Make/index.html | 2 +- dev/containers/Containers/Hashtbl/MakeSeeded/index.html | 2 +- dev/containers/Containers/Hashtbl/index.html | 2 +- dev/containers/Containers/Hashtbl/module-type-S'/index.html | 2 +- dev/containers/Containers/Hashtbl/module-type-S/index.html | 2 +- .../Containers/Hashtbl/module-type-SeededS/index.html | 2 +- dev/containers/ContainersLabels/Hashtbl/Make/index.html | 2 +- dev/containers/ContainersLabels/Hashtbl/MakeSeeded/index.html | 2 +- dev/containers/ContainersLabels/Hashtbl/index.html | 2 +- .../ContainersLabels/Hashtbl/module-type-S'/index.html | 2 +- .../ContainersLabels/Hashtbl/module-type-S/index.html | 2 +- .../ContainersLabels/Hashtbl/module-type-SeededS/index.html | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/dev/containers/CCArrayLabels/index.html b/dev/containers/CCArrayLabels/index.html index 8f038fa1..f4535a57 100644 --- a/dev/containers/CCArrayLabels/index.html +++ b/dev/containers/CCArrayLabels/index.html @@ -1,2 +1,2 @@ -CCArrayLabels (containers.CCArrayLabels)

Module CCArrayLabels

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

include module type of CCShimsArrayLabels_

Documentation for the standard ArrayLabels module

include module type of Stdlib.ArrayLabels with module CCArrayLabels.Floatarray = Stdlib.Array.Floatarray
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 init : int -> f:(int -> 'a) -> 'a array
val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val append : 'a array -> 'a array -> 'a array
val concat : 'a array list -> 'a array
val sub : 'a array -> pos:int -> len:int -> 'a array
val copy : 'a array -> 'a array
val fill : 'a array -> pos:int -> len:int -> 'a -> unit
val blit : src:'a array -> src_pos:int -> dst:'a array -> dst_pos:int -> len:int -> unit
val to_list : 'a array -> 'a list
val of_list : 'a list -> 'a array
val iter : f:('a -> unit) -> 'a array -> unit
val map : f:('a -> 'b) -> 'a array -> 'b array
val iteri : f:(int -> 'a -> unit) -> 'a array -> unit
val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b array -> 'a
val fold_right : f:('b -> 'a -> 'a) -> 'b array -> init:'a -> 'a
val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit
val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
val exists : f:('a -> bool) -> 'a array -> bool
val for_all : f:('a -> bool) -> 'a array -> bool
val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val mem : 'a -> set:'a array -> bool
val memq : 'a -> set:'a array -> bool
val create_float : int -> float array
val make_float : int -> float 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_seq : 'a array -> 'a Stdlib.Seq.t
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 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 -> '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 : f:('acc -> 'a -> 'acc * 'b) -> init:'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 : f:('acc -> 'a -> 'acc) -> init:'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 : f:('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 : f:('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 : f:('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 : f:('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 : f:(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 : f:('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 -> key:'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 -> key:'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) -> key:'a -> 'a t -> [ `All_lower | `All_bigger | `Just_after of int | `Empty | `At of int ]

bsearch ~cmp ~key a finds the index of the object key in the array a, provided a is sorted using cmp. If the array is not sorted, the result is not specified (may raise Invalid_argument).

Complexity: O(log n) where n is the length of the array a (dichotomic search).

returns
  • `At i if cmp a.(i) key = 0 (for some i).
  • `All_lower if all elements of a are lower than key.
  • `All_bigger if all elements of a are bigger than key.
  • `Just_after i if a.(i) < key < a.(i+1).
  • `Empty if the array a is empty.
raises Invalid_argument

if the array is found to be unsorted w.r.t cmp.

since
0.13
val for_all2 : f:('a -> 'b -> bool) -> 'a t -> 'b t -> bool

for_all2 ~f [|a1; …; an|] [|b1; …; bn|] is true if each pair of elements ai bi satisfies the predicate f. That is, it returns (f a1 b1) && (f a2 b2) && … && (f an bn).

raises Invalid_argument

if arrays have distinct lengths. Allow different types.

since
0.20
val exists2 : f:('a -> 'b -> bool) -> 'a t -> 'b t -> bool

exists2 ~f [|a1; …; an|] [|b1; …; bn|] is true if any pair of elements ai bi satisfies the predicate f. That is, it returns (f a1 b1) || (f a2 b2) || … || (f an bn).

raises Invalid_argument

if arrays have distinct lengths. Allow different types.

since
0.20
val fold2 : f:('acc -> 'a -> 'b -> 'acc) -> init:'acc -> 'a t -> 'b t -> 'acc

fold2 ~f ~init a b fold on two arrays a and b stepwise. It computes f (… (f init a1 b1) …) an bn.

raises Invalid_argument

if a and b have distinct lengths.

since
0.20
val iter2 : f:('a -> 'b -> unit) -> 'a t -> 'b t -> unit

iter2 ~f a b iterates on the two arrays a and b stepwise. It is equivalent to f a0 b0; …; f a.(length a - 1) b.(length b - 1); ().

raises Invalid_argument

if a and b have distinct lengths.

since
0.20
val shuffle : 'a t -> unit

shuffle a randomly shuffles the array a, in place.

val shuffle_with : Stdlib.Random.State.t -> 'a t -> unit

shuffle_with rs a randomly shuffles the array a (like shuffle) but a specialized random state rs is used to control the random numbers being produced during shuffling (for reproducibility).

val random_choose : 'a t -> 'a random_gen

random_choose a rs randomly chooses an element of a.

raises Not_found

if the array/slice is empty.

val to_string : ?⁠sep:string -> ('a -> string) -> 'a array -> string

to_string ~sep item_to_string a print a to a string using sep as a separator between elements of a.

since
2.7
val to_iter : 'a t -> 'a iter

to_iter a returns an iter of the elements of an array a. The input array a is shared with the sequence and modification of it will result in modification of the iterator.

since
2.8
val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq a returns a Seq.t of the elements of an array a. The input array a is shared with the sequence and modification of it will result in modification of the sequence. Renamed from to_std_seq since 3.0.

since
3.0
val to_gen : 'a t -> 'a gen

to_gen a returns a gen of the elements of an array a.

IO

val pp : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_sep:unit printer -> 'a printer -> 'a t printer

pp ~pp_start ~pp_stop ~pp_sep pp_item ppf a formats the array a on ppf. Each element is formatted with pp_item, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val pp_i : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_sep:unit printer -> (int -> 'a printer) -> 'a t printer

pp_i ~pp_start ~pp_stop ~pp_sep pp_item ppf a prints the array a on ppf. The printing function pp_item is giving both index and element. pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val map2 : f:('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map2 ~f a b applies function f to all elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); …; f a.(length a - 1) b.(length b - 1)|].

raises Invalid_argument

if a and b have distinct lengths.

since
0.20
val rev : 'a t -> 'a t

rev a copies the array a and reverses it in place.

since
0.20
val filter : f:('a -> bool) -> 'a t -> 'a t

filter ~f a filters elements out of the array a. Only the elements satisfying the given predicate f will be kept.

val filter_map : f:('a -> 'b option) -> 'a t -> 'b t

filter_map ~f [|a1; …; an|] calls (f a1) … (f an) and returns an array b consisting of all elements bi such as f ai = Some bi. When f returns None, the corresponding element of a is discarded.

val monoid_product : f:('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

monoid_product ~f a b passes all combinaisons of tuples from the two arrays a and b to the function f.

since
2.8
val flat_map : f:('a -> 'b t) -> 'a t -> 'b array

flat_map ~f a transforms each element of a into an array, then flattens.

val except_idx : 'a t -> int -> 'a list

except_idx a i removes the element of a at given index i, and returns the list of the other elements.

val random : 'a random_gen -> 'a t random_gen
val random_non_empty : 'a random_gen -> 'a t random_gen
val random_len : int -> 'a random_gen -> 'a t random_gen

Generic Functions

module type MONO_ARRAY = sig ... end
val sort_generic : (module MONO_ARRAY with type elt = 'elt and type t = 'arr) -> cmp:('elt -> 'elt -> int) -> 'arr -> unit

sort_generic (module M) ~cmp a sorts the array a, without allocating (eats stack space though). Performance might be lower than Array.sort.

since
0.14

Infix Operators

It is convenient to open CCArray.Infix to access the infix operators without cluttering the scope too much.

since
2.7
module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

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

a >>| f is the infix version of map.

since
0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

since
0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

since
0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

since
2.8
include CCShimsMkLet_.S with type 'a t_let := 'a array
type 'a t_let
val let+ : 'a t_let -> ('a -> 'b) -> 'b t_let
val and+ : 'a t_let -> 'b t_let -> ('a * 'b) t_let
val let* : 'a t_let -> ('a -> 'b t_let) -> 'b t_let
val and* : 'a t_let -> 'b t_let -> ('a * 'b) t_let
\ No newline at end of file +CCArrayLabels (containers.CCArrayLabels)

Module CCArrayLabels

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

include module type of CCShimsArrayLabels_

Documentation for the standard ArrayLabels module

include module type of Stdlib.ArrayLabels with module CCArrayLabels.Floatarray = Stdlib.Array.Floatarray
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 -> f:(int -> 'a) -> 'a array
val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val append : 'a array -> 'a array -> 'a array
val concat : 'a array list -> 'a array
val sub : 'a array -> pos:int -> len:int -> 'a array
val copy : 'a array -> 'a array
val fill : 'a array -> pos:int -> len:int -> 'a -> unit
val blit : src:'a array -> src_pos:int -> dst:'a array -> dst_pos:int -> len:int -> unit
val to_list : 'a array -> 'a list
val of_list : 'a list -> 'a array
val iter : f:('a -> unit) -> 'a array -> unit
val iteri : f:(int -> 'a -> unit) -> 'a array -> unit
val map : f:('a -> 'b) -> 'a array -> 'b array
val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b array -> 'a
val fold_right : f:('b -> 'a -> 'a) -> 'b array -> init:'a -> 'a
val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit
val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
val for_all : f:('a -> bool) -> 'a array -> bool
val exists : f:('a -> bool) -> 'a array -> bool
val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val mem : 'a -> set:'a array -> bool
val memq : 'a -> set:'a array -> bool
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_seq : 'a array -> 'a Stdlib.Seq.t
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 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 -> '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 : f:('acc -> 'a -> 'acc * 'b) -> init:'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 : f:('acc -> 'a -> 'acc) -> init:'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 : f:('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 : f:('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 : f:('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 : f:('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 : f:(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 : f:('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 -> key:'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 -> key:'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) -> key:'a -> 'a t -> [ `All_lower | `All_bigger | `Just_after of int | `Empty | `At of int ]

bsearch ~cmp ~key a finds the index of the object key in the array a, provided a is sorted using cmp. If the array is not sorted, the result is not specified (may raise Invalid_argument).

Complexity: O(log n) where n is the length of the array a (dichotomic search).

returns
  • `At i if cmp a.(i) key = 0 (for some i).
  • `All_lower if all elements of a are lower than key.
  • `All_bigger if all elements of a are bigger than key.
  • `Just_after i if a.(i) < key < a.(i+1).
  • `Empty if the array a is empty.
raises Invalid_argument

if the array is found to be unsorted w.r.t cmp.

since
0.13
val for_all2 : f:('a -> 'b -> bool) -> 'a t -> 'b t -> bool

for_all2 ~f [|a1; …; an|] [|b1; …; bn|] is true if each pair of elements ai bi satisfies the predicate f. That is, it returns (f a1 b1) && (f a2 b2) && … && (f an bn).

raises Invalid_argument

if arrays have distinct lengths. Allow different types.

since
0.20
val exists2 : f:('a -> 'b -> bool) -> 'a t -> 'b t -> bool

exists2 ~f [|a1; …; an|] [|b1; …; bn|] is true if any pair of elements ai bi satisfies the predicate f. That is, it returns (f a1 b1) || (f a2 b2) || … || (f an bn).

raises Invalid_argument

if arrays have distinct lengths. Allow different types.

since
0.20
val fold2 : f:('acc -> 'a -> 'b -> 'acc) -> init:'acc -> 'a t -> 'b t -> 'acc

fold2 ~f ~init a b fold on two arrays a and b stepwise. It computes f (… (f init a1 b1) …) an bn.

raises Invalid_argument

if a and b have distinct lengths.

since
0.20
val iter2 : f:('a -> 'b -> unit) -> 'a t -> 'b t -> unit

iter2 ~f a b iterates on the two arrays a and b stepwise. It is equivalent to f a0 b0; …; f a.(length a - 1) b.(length b - 1); ().

raises Invalid_argument

if a and b have distinct lengths.

since
0.20
val shuffle : 'a t -> unit

shuffle a randomly shuffles the array a, in place.

val shuffle_with : Stdlib.Random.State.t -> 'a t -> unit

shuffle_with rs a randomly shuffles the array a (like shuffle) but a specialized random state rs is used to control the random numbers being produced during shuffling (for reproducibility).

val random_choose : 'a t -> 'a random_gen

random_choose a rs randomly chooses an element of a.

raises Not_found

if the array/slice is empty.

val to_string : ?⁠sep:string -> ('a -> string) -> 'a array -> string

to_string ~sep item_to_string a print a to a string using sep as a separator between elements of a.

since
2.7
val to_iter : 'a t -> 'a iter

to_iter a returns an iter of the elements of an array a. The input array a is shared with the sequence and modification of it will result in modification of the iterator.

since
2.8
val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq a returns a Seq.t of the elements of an array a. The input array a is shared with the sequence and modification of it will result in modification of the sequence. Renamed from to_std_seq since 3.0.

since
3.0
val to_gen : 'a t -> 'a gen

to_gen a returns a gen of the elements of an array a.

IO

val pp : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_sep:unit printer -> 'a printer -> 'a t printer

pp ~pp_start ~pp_stop ~pp_sep pp_item ppf a formats the array a on ppf. Each element is formatted with pp_item, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val pp_i : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_sep:unit printer -> (int -> 'a printer) -> 'a t printer

pp_i ~pp_start ~pp_stop ~pp_sep pp_item ppf a prints the array a on ppf. The printing function pp_item is giving both index and element. pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val map2 : f:('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map2 ~f a b applies function f to all elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); …; f a.(length a - 1) b.(length b - 1)|].

raises Invalid_argument

if a and b have distinct lengths.

since
0.20
val rev : 'a t -> 'a t

rev a copies the array a and reverses it in place.

since
0.20
val filter : f:('a -> bool) -> 'a t -> 'a t

filter ~f a filters elements out of the array a. Only the elements satisfying the given predicate f will be kept.

val filter_map : f:('a -> 'b option) -> 'a t -> 'b t

filter_map ~f [|a1; …; an|] calls (f a1) … (f an) and returns an array b consisting of all elements bi such as f ai = Some bi. When f returns None, the corresponding element of a is discarded.

val monoid_product : f:('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

monoid_product ~f a b passes all combinaisons of tuples from the two arrays a and b to the function f.

since
2.8
val flat_map : f:('a -> 'b t) -> 'a t -> 'b array

flat_map ~f a transforms each element of a into an array, then flattens.

val except_idx : 'a t -> int -> 'a list

except_idx a i removes the element of a at given index i, and returns the list of the other elements.

val random : 'a random_gen -> 'a t random_gen
val random_non_empty : 'a random_gen -> 'a t random_gen
val random_len : int -> 'a random_gen -> 'a t random_gen

Generic Functions

module type MONO_ARRAY = sig ... end
val sort_generic : (module MONO_ARRAY with type elt = 'elt and type t = 'arr) -> cmp:('elt -> 'elt -> int) -> 'arr -> unit

sort_generic (module M) ~cmp a sorts the array a, without allocating (eats stack space though). Performance might be lower than Array.sort.

since
0.14

Infix Operators

It is convenient to open CCArray.Infix to access the infix operators without cluttering the scope too much.

since
2.7
module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

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

a >>| f is the infix version of map.

since
0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

since
0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

since
0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

since
2.8
include CCShimsMkLet_.S with type 'a t_let := 'a array
type 'a t_let
val let+ : 'a t_let -> ('a -> 'b) -> 'b t_let
val and+ : 'a t_let -> 'b t_let -> ('a * 'b) t_let
val let* : 'a t_let -> ('a -> 'b t_let) -> 'b t_let
val and* : 'a t_let -> 'b t_let -> ('a * 'b) t_let
\ No newline at end of file diff --git a/dev/containers/CCEither/index.html b/dev/containers/CCEither/index.html index 83a37381..c5ac34f3 100644 --- a/dev/containers/CCEither/index.html +++ b/dev/containers/CCEither/index.html @@ -1,2 +1,2 @@ -CCEither (containers.CCEither)

Module CCEither

Either Monad

Module that is compatible with Either form OCaml 4.12 but can be use with any ocaml version compatible with container

since
3.2
type 'a iter = ('a -> unit) -> unit
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Basics

include module type of CCShimsEither_
type ('a, 'b) t =
| Left of 'a
| Right of 'b
val left : 'a -> ('a'b) t

left l is Left l

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

right r is Right r

val is_left : ('a'b) t -> bool

is_left x checks if x = Left _

val is_right : ('a'b) t -> bool

is_right x checks if x = Right _

val find_left : ('a'b) t -> 'a option

find_left x returns l if x = Left l and None otherwise.

val find_right : ('a'b) t -> 'b option

find_right x returns r if x = Left r and None otherwise.

val map_left : ('a1 -> 'a2) -> ('a1'b) t -> ('a2'b) t

Map of the Left variant.

val map_right : ('b1 -> 'b2) -> ('a'b1) t -> ('a'b2) t

Map of the Right variant.

val map : left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1'b1) t -> ('a2'b2) t

Map using left or right.

val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a'b) t -> 'c

Fold using left or right.

val iter : left:('a -> unit) -> right:('b -> unit) -> ('a'b) t -> unit

Iter using left or right.

val for_all : left:('a -> bool) -> right:('b -> bool) -> ('a'b) t -> bool

Check some property on Left or Right variant.

val equal : left:('a -> 'a -> bool) -> right:('b -> 'b -> bool) -> ('a'b) t -> ('a'b) t -> bool
val compare : left:('a -> 'a -> int) -> right:('b -> 'b -> int) -> ('a'b) t -> ('a'b) t -> int

IO

val pp : left:'a printer -> right:'b printer -> ('a'b) t printer

Pretty printer.

\ No newline at end of file +CCEither (containers.CCEither)

Module CCEither

Either Monad

Module that is compatible with Either form OCaml 4.12 but can be use with any ocaml version compatible with container

since
3.2
type 'a iter = ('a -> unit) -> unit
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Basics

include module type of CCShimsEither_
type ('a, 'b) t = ('a'b) Stdlib.Either.t =
| Left of 'a
| Right of 'b
val left : 'a -> ('a'b) t

left l is Left l

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

right r is Right r

val is_left : ('a'b) t -> bool

is_left x checks if x = Left _

val is_right : ('a'b) t -> bool

is_right x checks if x = Right _

val find_left : ('a'b) t -> 'a option

find_left x returns l if x = Left l and None otherwise.

val find_right : ('a'b) t -> 'b option

find_right x returns r if x = Left r and None otherwise.

val map_left : ('a1 -> 'a2) -> ('a1'b) t -> ('a2'b) t

Map of the Left variant.

val map_right : ('b1 -> 'b2) -> ('a'b1) t -> ('a'b2) t

Map of the Right variant.

val map : left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1'b1) t -> ('a2'b2) t

Map using left or right.

val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a'b) t -> 'c

Fold using left or right.

val iter : left:('a -> unit) -> right:('b -> unit) -> ('a'b) t -> unit

Iter using left or right.

val for_all : left:('a -> bool) -> right:('b -> bool) -> ('a'b) t -> bool

Check some property on Left or Right variant.

val equal : left:('a -> 'a -> bool) -> right:('b -> 'b -> bool) -> ('a'b) t -> ('a'b) t -> bool
val compare : left:('a -> 'a -> int) -> right:('b -> 'b -> int) -> ('a'b) t -> ('a'b) t -> int

IO

val pp : left:'a printer -> right:'b printer -> ('a'b) t printer

Pretty printer.

\ No newline at end of file diff --git a/dev/containers/CCFormat/index.html b/dev/containers/CCFormat/index.html index f23d5513..f7ad7fc0 100644 --- a/dev/containers/CCFormat/index.html +++ b/dev/containers/CCFormat/index.html @@ -1,5 +1,5 @@ -CCFormat (containers.CCFormat)

Module CCFormat

Helpers for Format

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

Documentation for the standard Format module

include module type of sig ... end
type formatter = Stdlib__format.formatter
val pp_open_box : formatter -> int -> unit
val open_box : int -> unit
val pp_close_box : formatter -> unit -> unit
val close_box : unit -> unit
val pp_open_hbox : formatter -> unit -> unit
val open_hbox : unit -> unit
val pp_open_vbox : formatter -> int -> unit
val open_vbox : int -> unit
val pp_open_hvbox : formatter -> int -> unit
val open_hvbox : int -> unit
val pp_open_hovbox : formatter -> int -> unit
val open_hovbox : int -> unit
val pp_print_string : formatter -> string -> unit
val print_string : string -> unit
val pp_print_as : formatter -> int -> string -> unit
val print_as : int -> string -> unit
val pp_print_int : formatter -> int -> unit
val print_int : int -> unit
val pp_print_float : formatter -> float -> unit
val print_float : float -> unit
val pp_print_char : formatter -> char -> unit
val print_char : char -> unit
val pp_print_bool : formatter -> bool -> unit
val print_bool : bool -> unit
val pp_print_space : formatter -> unit -> unit
val print_space : unit -> unit
val pp_print_cut : formatter -> unit -> unit
val print_cut : unit -> unit
val pp_print_break : formatter -> int -> int -> unit
val print_break : int -> int -> unit
val pp_print_custom_break : formatter -> fits:(string * int * string) -> breaks:(string * int * string) -> unit
val pp_force_newline : formatter -> unit -> unit
val force_newline : unit -> unit
val pp_print_if_newline : formatter -> unit -> unit
val print_if_newline : unit -> unit
val pp_print_flush : formatter -> unit -> unit
val print_flush : unit -> unit
val pp_print_newline : formatter -> unit -> unit
val print_newline : unit -> unit
val pp_set_margin : formatter -> int -> unit
val set_margin : int -> unit
val pp_get_margin : formatter -> unit -> int
val get_margin : unit -> int
val pp_set_max_indent : formatter -> int -> unit
val set_max_indent : int -> unit
val pp_get_max_indent : formatter -> unit -> int
val get_max_indent : unit -> int
type geometry = Stdlib__format.geometry = {
max_indent : int;
margin : int;
}
val check_geometry : geometry -> bool
val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit
val set_geometry : max_indent:int -> margin:int -> unit
val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit
val safe_set_geometry : max_indent:int -> margin:int -> unit
val pp_update_geometry : formatter -> (geometry -> geometry) -> unit
val update_geometry : (geometry -> geometry) -> unit
val pp_get_geometry : formatter -> unit -> geometry
val get_geometry : unit -> geometry
val pp_set_max_boxes : formatter -> int -> unit
val set_max_boxes : int -> unit
val pp_get_max_boxes : formatter -> unit -> int
val get_max_boxes : unit -> int
val pp_over_max_boxes : formatter -> unit -> bool
val over_max_boxes : unit -> bool
val pp_open_tbox : formatter -> unit -> unit
val open_tbox : unit -> unit
val pp_close_tbox : formatter -> unit -> unit
val close_tbox : unit -> unit
val pp_set_tab : formatter -> unit -> unit
val set_tab : unit -> unit
val pp_print_tab : formatter -> unit -> unit
val print_tab : unit -> unit
val pp_print_tbreak : formatter -> int -> int -> unit
val print_tbreak : int -> int -> unit
val pp_set_ellipsis_text : formatter -> string -> unit
val set_ellipsis_text : string -> unit
val pp_get_ellipsis_text : formatter -> unit -> string
val get_ellipsis_text : unit -> string
type stag = Stdlib__format.stag = ..
type tag = string
type stag += String_tag of tag
val pp_open_stag : formatter -> stag -> unit
val open_stag : stag -> unit
val pp_close_stag : formatter -> unit -> unit
val close_stag : unit -> unit
val pp_set_tags : formatter -> bool -> unit
val set_tags : bool -> unit
val pp_set_print_tags : formatter -> bool -> unit
val set_print_tags : bool -> unit
val pp_set_mark_tags : formatter -> bool -> unit
val set_mark_tags : bool -> unit
val pp_get_print_tags : formatter -> unit -> bool
val get_print_tags : unit -> bool
val pp_get_mark_tags : formatter -> unit -> bool
val get_mark_tags : unit -> bool
val pp_set_formatter_out_channel : formatter -> Stdlib.out_channel -> unit
val set_formatter_out_channel : Stdlib.out_channel -> unit
val pp_set_formatter_output_functions : formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> unit
val set_formatter_output_functions : (string -> int -> int -> unit) -> (unit -> unit) -> unit
val pp_get_formatter_output_functions : formatter -> unit -> (string -> int -> int -> unit) * (unit -> unit)
val get_formatter_output_functions : unit -> (string -> int -> int -> unit) * (unit -> unit)
type formatter_out_functions = Stdlib__format.formatter_out_functions = {
out_string : string -> int -> int -> unit;
out_flush : unit -> unit;
out_newline : unit -> unit;
out_spaces : int -> unit;
out_indent : int -> unit;
}
val pp_set_formatter_out_functions : formatter -> formatter_out_functions -> unit
val set_formatter_out_functions : formatter_out_functions -> unit
val pp_get_formatter_out_functions : formatter -> unit -> formatter_out_functions
val get_formatter_out_functions : unit -> formatter_out_functions
type formatter_stag_functions = Stdlib__format.formatter_stag_functions = {
mark_open_stag : stag -> string;
mark_close_stag : stag -> string;
print_open_stag : stag -> unit;
print_close_stag : stag -> unit;
}
val pp_set_formatter_stag_functions : formatter -> formatter_stag_functions -> unit
val set_formatter_stag_functions : formatter_stag_functions -> unit
val pp_get_formatter_stag_functions : formatter -> unit -> formatter_stag_functions
val get_formatter_stag_functions : unit -> formatter_stag_functions
val formatter_of_out_channel : Stdlib.out_channel -> formatter
val std_formatter : formatter
val err_formatter : formatter
val formatter_of_buffer : Stdlib.Buffer.t -> formatter
val stdbuf : Stdlib.Buffer.t
val str_formatter : formatter
val flush_str_formatter : unit -> string
val make_formatter : (string -> int -> int -> unit) -> (unit -> unit) -> formatter
val formatter_of_out_functions : formatter_out_functions -> formatter
type symbolic_output_item = Stdlib__format.symbolic_output_item =
| Output_flush
| Output_newline
| Output_string of string
| Output_spaces of int
| Output_indent of int
type symbolic_output_buffer = Stdlib__format.symbolic_output_buffer
val make_symbolic_output_buffer : unit -> symbolic_output_buffer
val clear_symbolic_output_buffer : symbolic_output_buffer -> unit
val get_symbolic_output_buffer : symbolic_output_buffer -> symbolic_output_item list
val flush_symbolic_output_buffer : symbolic_output_buffer -> symbolic_output_item list
val add_symbolic_output_item : symbolic_output_buffer -> symbolic_output_item -> unit
val formatter_of_symbolic_output_buffer : symbolic_output_buffer -> formatter
val pp_print_list : ?⁠pp_sep:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
val pp_print_text : formatter -> string -> unit
val pp_print_option : ?⁠none:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> formatter -> 'a option -> unit
val pp_print_result : ok:(formatter -> 'a -> unit) -> error:(formatter -> 'e -> unit) -> formatter -> ('a'e) Stdlib.result -> unit
val fprintf : formatter -> ('aformatter, unit) Stdlib.format -> 'a
val printf : ('aformatter, unit) Stdlib.format -> 'a
val eprintf : ('aformatter, unit) Stdlib.format -> 'a
val sprintf : ('a, unit, string) Stdlib.format -> 'a
val asprintf : ('aformatter, unit, string) Stdlib.format4 -> 'a
val dprintf : ('aformatter, unit, formatter -> unit) Stdlib.format4 -> 'a
val ifprintf : formatter -> ('aformatter, unit) Stdlib.format -> 'a
val kfprintf : (formatter -> 'a) -> formatter -> ('bformatter, unit, 'a) Stdlib.format4 -> 'b
val kdprintf : ((formatter -> unit) -> 'a) -> ('bformatter, unit, 'a) Stdlib.format4 -> 'b
val ikfprintf : (formatter -> 'a) -> formatter -> ('bformatter, unit, 'a) Stdlib.format4 -> 'b
val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) Stdlib.format4 -> 'b
val kasprintf : (string -> 'a) -> ('bformatter, unit, 'a) Stdlib.format4 -> 'b
val bprintf : Stdlib.Buffer.t -> ('aformatter, unit) Stdlib.format -> 'a
val kprintf : (string -> 'a) -> ('b, unit, string, 'a) Stdlib.format4 -> 'b
val set_all_formatter_output_functions : out:(string -> int -> int -> unit) -> flush:(unit -> unit) -> newline:(unit -> unit) -> spaces:(int -> unit) -> unit
val get_all_formatter_output_functions : unit -> (string -> int -> int -> unit) * (unit -> unit) * (unit -> unit) * (int -> unit)
val pp_set_all_formatter_output_functions : formatter -> out:(string -> int -> int -> unit) -> flush:(unit -> unit) -> newline:(unit -> unit) -> spaces:(int -> unit) -> unit
val pp_get_all_formatter_output_functions : formatter -> unit -> (string -> int -> int -> unit) * (unit -> unit) * (unit -> unit) * (int -> unit)
val pp_open_tag : formatter -> tag -> unit
val open_tag : tag -> unit
val pp_close_tag : formatter -> unit -> unit
val close_tag : unit -> unit
type formatter_tag_functions = Stdlib__format.formatter_tag_functions = {
mark_open_tag : tag -> string;
mark_close_tag : tag -> string;
print_open_tag : tag -> unit;
print_close_tag : tag -> unit;
}
val pp_set_formatter_tag_functions : formatter -> formatter_tag_functions -> unit
val set_formatter_tag_functions : formatter_tag_functions -> unit
val pp_get_formatter_tag_functions : formatter -> unit -> formatter_tag_functions
val get_formatter_tag_functions : unit -> formatter_tag_functions
type t = Stdlib.Format.formatter
type 'a printer = t -> 'a -> unit

Combinators

val silent : 'a printer

Prints nothing.

val unit : unit printer

Prints "()".

val int : int printer
val string : string printer
val bool : bool printer
val float3 : float printer
val float : float printer
val exn : exn printer

Printer using Printexc.to_string.

since
3.0
val space : unit printer

Alias to pp_print_space.

since
3.2
val cut : unit printer

Alias to pp_print_cut.

since
3.2
val break : (int * int) printer

Tuple-ized printer form of pp_print_break.

since
3.2
val newline : unit printer

Force newline (see Format.pp_force_newline).

since
1.2
val substring : (string * int * int) printer

substring (s,i,len) prints the substring (s,i,len), where i is the offset in s and len the number of bytes in the substring.

raises Invalid_argument

if the triple (s,i,len) does not describe a proper substring.

since
1.2
val text : string printer

Print string, but replacing spaces with breaks and newlines with newline. See pp_print_text on recent versions of OCaml.

since
1.2
val string_lines : string printer

string_lines out s prints s with all newlines ('\n') replaced by a cut, in a vertical box. It does NOT insert breakable spaces in place of spaces, unlike text. This means an already formatted string can be displayed inside another formatter without mangling the indentation.

since
3.3
val char : char printer
since
0.14
val int32 : int32 printer
since
0.14
val int64 : int64 printer
since
0.14
val nativeint : nativeint printer
since
0.14
val flush : unit printer

Alias to Format.pp_print_flush.

since
1.2
val string_quoted : string printer

Similar to CCString.print.

since
0.14
val list : ?⁠sep:unit printer -> 'a printer -> 'a list printer
val array : ?⁠sep:unit printer -> 'a printer -> 'a array printer
val arrayi : ?⁠sep:unit printer -> (int * 'a) printer -> 'a array printer
val seq : ?⁠sep:unit printer -> 'a printer -> 'a Stdlib.Seq.t printer
val iter : ?⁠sep:unit printer -> 'a printer -> 'a iter printer
val opt : 'a printer -> 'a option printer

opt pp prints options as follows:

  • Some x will become "some foo" if pp x ---> "foo".
  • None will become "none".
val pair : ?⁠sep:unit printer -> 'a printer -> 'b printer -> ('a * 'b) printer
val triple : ?⁠sep:unit printer -> 'a printer -> 'b printer -> 'c printer -> ('a * 'b * 'c) printer
val quad : ?⁠sep:unit printer -> 'a printer -> 'b printer -> 'c printer -> 'd printer -> ('a * 'b * 'c * 'd) printer
val append : unit printer -> unit printer -> unit printer

append ppa ppb first prints ppa (), then prints ppb ().

since
3.2
val append_l : unit printer list -> unit printer

append_l pps runs the printers in pps sequentially.

since
3.2
val within : string -> string -> 'a printer -> 'a printer

within a b p wraps p inside the strings a and b. Convenient, for instances, for brackets, parenthesis, quotes, etc.

since
0.17
val map : ('a -> 'b) -> 'b printer -> 'a printer
val vbox : ?⁠i:int -> 'a printer -> 'a printer

Wrap the printer in a vertical box.

parameter i

level of indentation within the box (default 0).

since
0.16
val hvbox : ?⁠i:int -> 'a printer -> 'a printer

Wrap the printer in a horizontal/vertical box.

parameter i

level of indentation within the box (default 0).

since
0.16
val hovbox : ?⁠i:int -> 'a printer -> 'a printer

Wrap the printer in a horizontal or vertical box.

parameter i

level of indentation within the box (default 0).

since
0.16
val hbox : 'a printer -> 'a printer

Wrap the printer in an horizontal box.

since
0.16
val return : ('a__'a) Stdlib.format4 -> unit printer

return "some_format_string" takes a argument-less format string and returns a printer actionable by (). Examples:

  • return ",@ "
  • return "@{<Red>and then@}@,"
  • return "@[<v>a@ b@]"
since
1.0
val of_to_string : ('a -> string) -> 'a printer

of_to_string f converts its input to a string using f, then prints the string.

since
1.0
val const : 'a printer -> 'a -> unit printer

const pp x is a unit printer that uses pp on x.

since
1.0
val some : 'a printer -> 'a option printer

some pp will print options as follows:

  • Some x is printed using pp on x
  • None is not printed at all
since
1.0
val lazy_force : 'a printer -> 'a lazy_t printer

lazy_force pp out x forces x and prints the result with pp.

since
2.0
val lazy_or : ?⁠default:unit printer -> 'a printer -> 'a lazy_t printer

lazy_or ?default pp out x prints default if x is not evaluated yet, or uses pp otherwise.

since
2.0

ANSI codes

Use ANSI escape codes https://en.wikipedia.org/wiki/ANSI_escape_code to put some colors on the terminal.

This uses tags in format strings to specify the style. Current styles are the following:

  • "reset" resets style
  • "black"
  • "red"
  • "green"
  • "yellow"
  • "blue"
  • "magenta"
  • "cyan"
  • "white"
  • "bold" bold font
  • "Black" bold black
  • "Red" bold red
  • "Green" bold green
  • "Yellow" bold yellow
  • "Blue" bold blue
  • "Magenta" bold magenta
  • "Cyan" bold cyan
  • "White" bold white

Example:

set_color_default true;;
+CCFormat (containers.CCFormat)

Module CCFormat

Helpers for Format

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

Documentation for the standard Format module

include module type of sig ... end
type formatter = Stdlib__format.formatter
val pp_open_box : formatter -> int -> unit
val open_box : int -> unit
val pp_close_box : formatter -> unit -> unit
val close_box : unit -> unit
val pp_open_hbox : formatter -> unit -> unit
val open_hbox : unit -> unit
val pp_open_vbox : formatter -> int -> unit
val open_vbox : int -> unit
val pp_open_hvbox : formatter -> int -> unit
val open_hvbox : int -> unit
val pp_open_hovbox : formatter -> int -> unit
val open_hovbox : int -> unit
val pp_print_string : formatter -> string -> unit
val print_string : string -> unit
val pp_print_as : formatter -> int -> string -> unit
val print_as : int -> string -> unit
val pp_print_int : formatter -> int -> unit
val print_int : int -> unit
val pp_print_float : formatter -> float -> unit
val print_float : float -> unit
val pp_print_char : formatter -> char -> unit
val print_char : char -> unit
val pp_print_bool : formatter -> bool -> unit
val print_bool : bool -> unit
val pp_print_space : formatter -> unit -> unit
val print_space : unit -> unit
val pp_print_cut : formatter -> unit -> unit
val print_cut : unit -> unit
val pp_print_break : formatter -> int -> int -> unit
val print_break : int -> int -> unit
val pp_print_custom_break : formatter -> fits:(string * int * string) -> breaks:(string * int * string) -> unit
val pp_force_newline : formatter -> unit -> unit
val force_newline : unit -> unit
val pp_print_if_newline : formatter -> unit -> unit
val print_if_newline : unit -> unit
val pp_print_flush : formatter -> unit -> unit
val print_flush : unit -> unit
val pp_print_newline : formatter -> unit -> unit
val print_newline : unit -> unit
val pp_set_margin : formatter -> int -> unit
val set_margin : int -> unit
val pp_get_margin : formatter -> unit -> int
val get_margin : unit -> int
val pp_set_max_indent : formatter -> int -> unit
val set_max_indent : int -> unit
val pp_get_max_indent : formatter -> unit -> int
val get_max_indent : unit -> int
type geometry = Stdlib__format.geometry = {
max_indent : int;
margin : int;
}
val check_geometry : geometry -> bool
val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit
val set_geometry : max_indent:int -> margin:int -> unit
val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit
val safe_set_geometry : max_indent:int -> margin:int -> unit
val pp_update_geometry : formatter -> (geometry -> geometry) -> unit
val update_geometry : (geometry -> geometry) -> unit
val pp_get_geometry : formatter -> unit -> geometry
val get_geometry : unit -> geometry
val pp_set_max_boxes : formatter -> int -> unit
val set_max_boxes : int -> unit
val pp_get_max_boxes : formatter -> unit -> int
val get_max_boxes : unit -> int
val pp_over_max_boxes : formatter -> unit -> bool
val over_max_boxes : unit -> bool
val pp_open_tbox : formatter -> unit -> unit
val open_tbox : unit -> unit
val pp_close_tbox : formatter -> unit -> unit
val close_tbox : unit -> unit
val pp_set_tab : formatter -> unit -> unit
val set_tab : unit -> unit
val pp_print_tab : formatter -> unit -> unit
val print_tab : unit -> unit
val pp_print_tbreak : formatter -> int -> int -> unit
val print_tbreak : int -> int -> unit
val pp_set_ellipsis_text : formatter -> string -> unit
val set_ellipsis_text : string -> unit
val pp_get_ellipsis_text : formatter -> unit -> string
val get_ellipsis_text : unit -> string
type stag = Stdlib__format.stag = ..
type tag = string
type stag += String_tag of tag
val pp_open_stag : formatter -> stag -> unit
val open_stag : stag -> unit
val pp_close_stag : formatter -> unit -> unit
val close_stag : unit -> unit
val pp_set_tags : formatter -> bool -> unit
val set_tags : bool -> unit
val pp_set_print_tags : formatter -> bool -> unit
val set_print_tags : bool -> unit
val pp_set_mark_tags : formatter -> bool -> unit
val set_mark_tags : bool -> unit
val pp_get_print_tags : formatter -> unit -> bool
val get_print_tags : unit -> bool
val pp_get_mark_tags : formatter -> unit -> bool
val get_mark_tags : unit -> bool
val pp_set_formatter_out_channel : formatter -> Stdlib.out_channel -> unit
val set_formatter_out_channel : Stdlib.out_channel -> unit
val pp_set_formatter_output_functions : formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> unit
val set_formatter_output_functions : (string -> int -> int -> unit) -> (unit -> unit) -> unit
val pp_get_formatter_output_functions : formatter -> unit -> (string -> int -> int -> unit) * (unit -> unit)
val get_formatter_output_functions : unit -> (string -> int -> int -> unit) * (unit -> unit)
type formatter_out_functions = Stdlib__format.formatter_out_functions = {
out_string : string -> int -> int -> unit;
out_flush : unit -> unit;
out_newline : unit -> unit;
out_spaces : int -> unit;
out_indent : int -> unit;
}
val pp_set_formatter_out_functions : formatter -> formatter_out_functions -> unit
val set_formatter_out_functions : formatter_out_functions -> unit
val pp_get_formatter_out_functions : formatter -> unit -> formatter_out_functions
val get_formatter_out_functions : unit -> formatter_out_functions
type formatter_stag_functions = Stdlib__format.formatter_stag_functions = {
mark_open_stag : stag -> string;
mark_close_stag : stag -> string;
print_open_stag : stag -> unit;
print_close_stag : stag -> unit;
}
val pp_set_formatter_stag_functions : formatter -> formatter_stag_functions -> unit
val set_formatter_stag_functions : formatter_stag_functions -> unit
val pp_get_formatter_stag_functions : formatter -> unit -> formatter_stag_functions
val get_formatter_stag_functions : unit -> formatter_stag_functions
val formatter_of_out_channel : Stdlib.out_channel -> formatter
val std_formatter : formatter
val err_formatter : formatter
val formatter_of_buffer : Stdlib.Buffer.t -> formatter
val stdbuf : Stdlib.Buffer.t
val str_formatter : formatter
val flush_str_formatter : unit -> string
val make_formatter : (string -> int -> int -> unit) -> (unit -> unit) -> formatter
val formatter_of_out_functions : formatter_out_functions -> formatter
type symbolic_output_item = Stdlib__format.symbolic_output_item =
| Output_flush
| Output_newline
| Output_string of string
| Output_spaces of int
| Output_indent of int
type symbolic_output_buffer = Stdlib__format.symbolic_output_buffer
val make_symbolic_output_buffer : unit -> symbolic_output_buffer
val clear_symbolic_output_buffer : symbolic_output_buffer -> unit
val get_symbolic_output_buffer : symbolic_output_buffer -> symbolic_output_item list
val flush_symbolic_output_buffer : symbolic_output_buffer -> symbolic_output_item list
val add_symbolic_output_item : symbolic_output_buffer -> symbolic_output_item -> unit
val formatter_of_symbolic_output_buffer : symbolic_output_buffer -> formatter
val pp_print_list : ?⁠pp_sep:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
val pp_print_seq : ?⁠pp_sep:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> formatter -> 'a Stdlib.Seq.t -> unit
val pp_print_text : formatter -> string -> unit
val pp_print_option : ?⁠none:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> formatter -> 'a option -> unit
val pp_print_result : ok:(formatter -> 'a -> unit) -> error:(formatter -> 'e -> unit) -> formatter -> ('a'e) Stdlib.result -> unit
val fprintf : formatter -> ('aformatter, unit) Stdlib.format -> 'a
val printf : ('aformatter, unit) Stdlib.format -> 'a
val eprintf : ('aformatter, unit) Stdlib.format -> 'a
val sprintf : ('a, unit, string) Stdlib.format -> 'a
val asprintf : ('aformatter, unit, string) Stdlib.format4 -> 'a
val dprintf : ('aformatter, unit, formatter -> unit) Stdlib.format4 -> 'a
val ifprintf : formatter -> ('aformatter, unit) Stdlib.format -> 'a
val kfprintf : (formatter -> 'a) -> formatter -> ('bformatter, unit, 'a) Stdlib.format4 -> 'b
val kdprintf : ((formatter -> unit) -> 'a) -> ('bformatter, unit, 'a) Stdlib.format4 -> 'b
val ikfprintf : (formatter -> 'a) -> formatter -> ('bformatter, unit, 'a) Stdlib.format4 -> 'b
val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) Stdlib.format4 -> 'b
val kasprintf : (string -> 'a) -> ('bformatter, unit, 'a) Stdlib.format4 -> 'b
val bprintf : Stdlib.Buffer.t -> ('aformatter, unit) Stdlib.format -> 'a
val kprintf : (string -> 'a) -> ('b, unit, string, 'a) Stdlib.format4 -> 'b
val set_all_formatter_output_functions : out:(string -> int -> int -> unit) -> flush:(unit -> unit) -> newline:(unit -> unit) -> spaces:(int -> unit) -> unit
val get_all_formatter_output_functions : unit -> (string -> int -> int -> unit) * (unit -> unit) * (unit -> unit) * (int -> unit)
val pp_set_all_formatter_output_functions : formatter -> out:(string -> int -> int -> unit) -> flush:(unit -> unit) -> newline:(unit -> unit) -> spaces:(int -> unit) -> unit
val pp_get_all_formatter_output_functions : formatter -> unit -> (string -> int -> int -> unit) * (unit -> unit) * (unit -> unit) * (int -> unit)
val pp_open_tag : formatter -> tag -> unit
val open_tag : tag -> unit
val pp_close_tag : formatter -> unit -> unit
val close_tag : unit -> unit
type formatter_tag_functions = Stdlib__format.formatter_tag_functions = {
mark_open_tag : tag -> string;
mark_close_tag : tag -> string;
print_open_tag : tag -> unit;
print_close_tag : tag -> unit;
}
val pp_set_formatter_tag_functions : formatter -> formatter_tag_functions -> unit
val set_formatter_tag_functions : formatter_tag_functions -> unit
val pp_get_formatter_tag_functions : formatter -> unit -> formatter_tag_functions
val get_formatter_tag_functions : unit -> formatter_tag_functions
type t = Stdlib.Format.formatter
type 'a printer = t -> 'a -> unit

Combinators

val silent : 'a printer

Prints nothing.

val unit : unit printer

Prints "()".

val int : int printer
val string : string printer
val bool : bool printer
val float3 : float printer
val float : float printer
val exn : exn printer

Printer using Printexc.to_string.

since
3.0
val space : unit printer

Alias to pp_print_space.

since
3.2
val cut : unit printer

Alias to pp_print_cut.

since
3.2
val break : (int * int) printer

Tuple-ized printer form of pp_print_break.

since
3.2
val newline : unit printer

Force newline (see Format.pp_force_newline).

since
1.2
val substring : (string * int * int) printer

substring (s,i,len) prints the substring (s,i,len), where i is the offset in s and len the number of bytes in the substring.

raises Invalid_argument

if the triple (s,i,len) does not describe a proper substring.

since
1.2
val text : string printer

Print string, but replacing spaces with breaks and newlines with newline. See pp_print_text on recent versions of OCaml.

since
1.2
val string_lines : string printer

string_lines out s prints s with all newlines ('\n') replaced by a cut, in a vertical box. It does NOT insert breakable spaces in place of spaces, unlike text. This means an already formatted string can be displayed inside another formatter without mangling the indentation.

since
3.3
val char : char printer
since
0.14
val int32 : int32 printer
since
0.14
val int64 : int64 printer
since
0.14
val nativeint : nativeint printer
since
0.14
val flush : unit printer

Alias to Format.pp_print_flush.

since
1.2
val string_quoted : string printer

Similar to CCString.print.

since
0.14
val list : ?⁠sep:unit printer -> 'a printer -> 'a list printer
val array : ?⁠sep:unit printer -> 'a printer -> 'a array printer
val arrayi : ?⁠sep:unit printer -> (int * 'a) printer -> 'a array printer
val seq : ?⁠sep:unit printer -> 'a printer -> 'a Stdlib.Seq.t printer
val iter : ?⁠sep:unit printer -> 'a printer -> 'a iter printer
val opt : 'a printer -> 'a option printer

opt pp prints options as follows:

  • Some x will become "some foo" if pp x ---> "foo".
  • None will become "none".
val pair : ?⁠sep:unit printer -> 'a printer -> 'b printer -> ('a * 'b) printer
val triple : ?⁠sep:unit printer -> 'a printer -> 'b printer -> 'c printer -> ('a * 'b * 'c) printer
val quad : ?⁠sep:unit printer -> 'a printer -> 'b printer -> 'c printer -> 'd printer -> ('a * 'b * 'c * 'd) printer
val append : unit printer -> unit printer -> unit printer

append ppa ppb first prints ppa (), then prints ppb ().

since
3.2
val append_l : unit printer list -> unit printer

append_l pps runs the printers in pps sequentially.

since
3.2
val within : string -> string -> 'a printer -> 'a printer

within a b p wraps p inside the strings a and b. Convenient, for instances, for brackets, parenthesis, quotes, etc.

since
0.17
val map : ('a -> 'b) -> 'b printer -> 'a printer
val vbox : ?⁠i:int -> 'a printer -> 'a printer

Wrap the printer in a vertical box.

parameter i

level of indentation within the box (default 0).

since
0.16
val hvbox : ?⁠i:int -> 'a printer -> 'a printer

Wrap the printer in a horizontal/vertical box.

parameter i

level of indentation within the box (default 0).

since
0.16
val hovbox : ?⁠i:int -> 'a printer -> 'a printer

Wrap the printer in a horizontal or vertical box.

parameter i

level of indentation within the box (default 0).

since
0.16
val hbox : 'a printer -> 'a printer

Wrap the printer in an horizontal box.

since
0.16
val return : ('a__'a) Stdlib.format4 -> unit printer

return "some_format_string" takes a argument-less format string and returns a printer actionable by (). Examples:

  • return ",@ "
  • return "@{<Red>and then@}@,"
  • return "@[<v>a@ b@]"
since
1.0
val of_to_string : ('a -> string) -> 'a printer

of_to_string f converts its input to a string using f, then prints the string.

since
1.0
val const : 'a printer -> 'a -> unit printer

const pp x is a unit printer that uses pp on x.

since
1.0
val some : 'a printer -> 'a option printer

some pp will print options as follows:

  • Some x is printed using pp on x
  • None is not printed at all
since
1.0
val lazy_force : 'a printer -> 'a lazy_t printer

lazy_force pp out x forces x and prints the result with pp.

since
2.0
val lazy_or : ?⁠default:unit printer -> 'a printer -> 'a lazy_t printer

lazy_or ?default pp out x prints default if x is not evaluated yet, or uses pp otherwise.

since
2.0

ANSI codes

Use ANSI escape codes https://en.wikipedia.org/wiki/ANSI_escape_code to put some colors on the terminal.

This uses tags in format strings to specify the style. Current styles are the following:

  • "reset" resets style
  • "black"
  • "red"
  • "green"
  • "yellow"
  • "blue"
  • "magenta"
  • "cyan"
  • "white"
  • "bold" bold font
  • "Black" bold black
  • "Red" bold red
  • "Green" bold green
  • "Yellow" bold yellow
  • "Blue" bold blue
  • "Magenta" bold magenta
  • "Cyan" bold cyan
  • "White" bold white

Example:

set_color_default true;;
 
 Format.printf
   "what is your @{<White>favorite color@}? @{<blue>blue@}! No, @{<red>red@}! Ahhhhhhh@.";;

status: unstable

since
0.15
val set_color_tag_handling : t -> unit

Add functions to support color tags to the given formatter.

since
0.15
val set_color_default : bool -> unit

set_color_default b enables color handling on the standard formatters (stdout, stderr) if b = true as well as on sprintf formatters; it disables the color handling if b = false.

val with_color : string -> 'a printer -> 'a printer

with_color "Blue" pp behaves like the printer pp, but with the given style.

status: unstable

since
0.16
val with_colorf : string -> t -> ('at, unit, unit) Stdlib.format4 -> 'a

with_colorf "Blue" out "%s %d" "yolo" 42 will behave like Format.fprintf, but wrapping the content with the given style.

status: unstable

since
0.16
val with_color_sf : string -> ('at, unit, string) Stdlib.format4 -> 'a

with_color_sf "Blue" out "%s %d" "yolo" 42 will behave like sprintf, but wrapping the content with the given style.

Example:

CCFormat.with_color_sf "red" "%a" CCFormat.Dump.(list int) [1;2;3] |> print_endline;;

status: unstable

since
0.21
val with_color_ksf : f:(string -> 'b) -> string -> ('at, unit, 'b) Stdlib.format4 -> 'a

with_color_ksf "Blue" ~f "%s %d" "yolo" 42 will behave like ksprintf, but wrapping the content with the given style.

Example: the following with raise Failure with a colored message

CCFormat.with_color_ksf "red" ~f:failwith "%a" CCFormat.Dump.(list int) [1;2;3];;
since
1.2

IO

val output : t -> 'a printer -> 'a -> unit
val to_string : 'a printer -> 'a -> string
val of_chan : Stdlib.out_channel -> t

Alias to Format.formatter_of_out_channel.

since
1.2
val with_out_chan : Stdlib.out_channel -> (t -> 'a) -> 'a

with_out_chan oc f turns oc into a formatter fmt, and call f fmt. Behaves like f fmt from then on, but whether the call to f fails or returns, fmt is flushed before the call terminates.

since
1.2
val stdout : t
val stderr : t
val tee : t -> t -> t

tee a b makes a new formatter that writes in both a and b.

since
1.0
val sprintf : ('at, unit, string) Stdlib.format4 -> 'a

Print into a string any format string that would usually be compatible with fprintf. Like Format.asprintf.

val sprintf_no_color : ('at, unit, string) Stdlib.format4 -> 'a

Like sprintf but never prints colors.

since
0.16
val sprintf_dyn_color : colors:bool -> ('at, unit, string) Stdlib.format4 -> 'a

Like sprintf but enable/disable colors depending on colors.

Example:

(* with colors *)
diff --git a/dev/containers/CCHashtbl/module-type-S/index.html b/dev/containers/CCHashtbl/module-type-S/index.html
index 06af019a..7daa3f49 100644
--- a/dev/containers/CCHashtbl/module-type-S/index.html
+++ b/dev/containers/CCHashtbl/module-type-S/index.html
@@ -1,2 +1,2 @@
 
-S (containers.CCHashtbl.S)

Module type CCHashtbl.S

include Stdlib.Hashtbl.S
type key
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : 'a t -> key -> 'a option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : 'a t -> key -> default:'a -> 'a

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val add_list : 'a list t -> key -> 'a -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val incr : ?⁠by:int -> int t -> key -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> int t -> key -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val keys : 'a t -> key iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : 'a t -> 'a iter

values tbl f iterates on values in the table.

val keys_list : _ t -> key list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : 'a t -> 'a list

values_list t is the list of values in t.

since
0.8
val map_list : (key -> 'a -> 'b) -> 'a t -> 'b list

Map on a hashtable's items, collect into a list.

val to_iter : 'a t -> (key * 'a) iter

Iterate on bindings in the table.

since
2.8
val add_iter : 'a t -> (key * 'a) iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : (key * 'a) iter -> 'a t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) iter -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : int t -> key iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : int t -> key Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from of_std_seq_count since 3.0.

since
3.0
val of_iter_count : key iter -> int t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : key Stdlib.Seq.t -> int t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : 'a t -> (key * 'a) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : 'a t -> f:(key -> 'a) -> k:key -> 'a

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_sep:unit printer -> ?⁠pp_arrow:unit printer -> key printer -> 'a printer -> 'a t printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
\ No newline at end of file +S (containers.CCHashtbl.S)

Module type CCHashtbl.S

include Stdlib.Hashtbl.S
type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : 'a t -> key -> 'a option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : 'a t -> key -> default:'a -> 'a

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val add_list : 'a list t -> key -> 'a -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val incr : ?⁠by:int -> int t -> key -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> int t -> key -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val keys : 'a t -> key iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : 'a t -> 'a iter

values tbl f iterates on values in the table.

val keys_list : _ t -> key list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : 'a t -> 'a list

values_list t is the list of values in t.

since
0.8
val map_list : (key -> 'a -> 'b) -> 'a t -> 'b list

Map on a hashtable's items, collect into a list.

val to_iter : 'a t -> (key * 'a) iter

Iterate on bindings in the table.

since
2.8
val add_iter : 'a t -> (key * 'a) iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : (key * 'a) iter -> 'a t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) iter -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : int t -> key iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : int t -> key Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from of_std_seq_count since 3.0.

since
3.0
val of_iter_count : key iter -> int t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : key Stdlib.Seq.t -> int t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : 'a t -> (key * 'a) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : 'a t -> f:(key -> 'a) -> k:key -> 'a

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_sep:unit printer -> ?⁠pp_arrow:unit printer -> key printer -> 'a printer -> 'a t printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
\ No newline at end of file diff --git a/dev/containers/CCList/index.html b/dev/containers/CCList/index.html index 2a427917..6d512ca8 100644 --- a/dev/containers/CCList/index.html +++ b/dev/containers/CCList/index.html @@ -1,5 +1,5 @@ -CCList (containers.CCList)

Module CCList

Complements to list

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

Fast internal iterator.

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

Documentation for the standard List module

include module type of Stdlib.List
type !'a t = 'a list =
| ([])
| (::) of 'a * 'a list
val length : 'a list -> int
val compare_lengths : 'a list -> 'b list -> int
val compare_length_with : 'a list -> int -> int
val cons : 'a -> 'a list -> 'a list
val hd : 'a list -> 'a
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val nth_opt : 'a list -> int -> 'a option
val rev : 'a list -> 'a list
val init : int -> (int -> 'a) -> 'a list
val append : 'a list -> 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
val flatten : 'a list list -> 'a list
val iter : ('a -> unit) -> 'a list -> unit
val iteri : (int -> 'a -> unit) -> 'a list -> unit
val map : ('a -> 'b) -> 'a list -> 'b list
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
val rev_map : ('a -> 'b) -> 'a list -> 'b list
val filter_map : ('a -> 'b option) -> 'a list -> 'b list
val concat_map : ('a -> 'b list) -> 'a list -> 'b list
val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a
val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit
val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a
val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
val for_all : ('a -> bool) -> 'a list -> bool
val exists : ('a -> bool) -> 'a list -> bool
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val mem : 'a -> 'a list -> bool
val memq : 'a -> 'a list -> bool
val find : ('a -> bool) -> 'a list -> 'a
val find_opt : ('a -> bool) -> 'a list -> 'a option
val find_map : ('a -> 'b option) -> 'a list -> 'b option
val filter : ('a -> bool) -> 'a list -> 'a list
val find_all : ('a -> bool) -> 'a list -> 'a list
val filteri : (int -> 'a -> bool) -> 'a list -> 'a list
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
val assoc : 'a -> ('a * 'b) list -> 'b
val assoc_opt : 'a -> ('a * 'b) list -> 'b option
val assq : 'a -> ('a * 'b) list -> 'b
val assq_opt : 'a -> ('a * 'b) list -> 'b option
val mem_assoc : 'a -> ('a * 'b) list -> bool
val mem_assq : 'a -> ('a * 'b) list -> bool
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val split : ('a * 'b) list -> 'a list * 'b list
val combine : 'a list -> 'b list -> ('a * 'b) list
val sort : ('a -> 'a -> int) -> 'a list -> 'a list
val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list
val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
val to_seq : 'a list -> 'a Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a list
type 'a t = 'a list
val empty : 'a t

empty is [].

val is_empty : _ t -> bool

is_empty l returns true iff l = [].

since
0.11
val map : ('a -> 'b) -> 'a t -> 'b t

map f [a0; a1; …; an] applies function f in turn to a0; a1; …; an. Safe version of List.map.

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

l >|= f is the infix version of map with reversed arguments.

since
0.5
val append : 'a t -> 'a t -> 'a t

append l1 l2 returns the list that is the concatenation of l1 and l2. Safe version of List.append.

val cons_maybe : 'a option -> 'a t -> 'a t

cons_maybe (Some x) l is x :: l. cons_maybe None l is l.

since
0.13
val cons' : 'a t -> 'a -> 'a t

cons' l x is the same as x :: l. This is convenient for fold functions such as List.fold_left or Array.fold_left.

since
3.3
val (@) : 'a t -> 'a t -> 'a t

l1 @ l2 is like append l1 l2. Concatenate the two lists l1 and l2.

val filter : ('a -> bool) -> 'a t -> 'a t

filter p l returns all the elements of the list l that satisfy the predicate p. The order of the elements in the input list l is preserved. Safe version of List.filter.

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

fold_right f [a1; …; an] b is f a1 (f a2 ( … (f an b) … )). Safe version of List.fold_right.

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

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

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

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

since
0.14
val fold_map_i : ('acc -> int -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list

fold_map_i f init l is a foldi-like function, but it also maps the list to another list.

since
2.8
val fold_on_map : f:('a -> 'b) -> reduce:('acc -> 'b -> 'acc) -> 'acc -> 'a list -> 'acc

fold_on_map ~f ~reduce init l combines map f and fold_left reduce init in one operation.

since
2.8
val scan_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc list

scan_left f init l returns the list [init; f init x0; f (f init x0) x1; …] where x0, x1, etc. are the elements of l.

since
1.2, but only
since
2.2 with labels
val reduce : ('a -> 'a -> 'a) -> 'a list -> 'a option

reduce f (hd::tl) returns Some (fold_left f hd tl). If l is empty, then None is returned.

since
3.2
val reduce_exn : ('a -> 'a -> 'a) -> 'a list -> 'a

reduce_exn is the unsafe version of reduce.

raises Invalid_argument

if the given list is empty.

since
3.2
val fold_map2 : ('acc -> 'a -> 'b -> 'acc * 'c) -> 'acc -> 'a list -> 'b list -> 'acc * 'c list

fold_map2 f init l1 l2 is to fold_map what List.map2 is to List.map.

raises Invalid_argument

if the lists do not have the same length.

since
0.16
val fold_filter_map : ('acc -> 'a -> 'acc * 'b option) -> 'acc -> 'a list -> 'acc * 'b list

fold_filter_map f init l is a fold_left-like function, but also generates a list of output in a way similar to filter_map.

since
0.17
val fold_filter_map_i : ('acc -> int -> 'a -> 'acc * 'b option) -> 'acc -> 'a list -> 'acc * 'b list

fold_filter_map_i f init l is a foldi-like function, but also generates a list of output in a way similar to filter_map.

since
2.8
val fold_flat_map : ('acc -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * 'b list

fold_flat_map f init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

since
0.14
val fold_flat_map_i : ('acc -> int -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * 'b list

fold_flat_map_i f init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

since
2.8
val count : ('a -> bool) -> 'a list -> int

count p l counts how many elements of l satisfy predicate p.

since
1.5, but only
since
2.2 with labels
val count_true_false : ('a -> bool) -> 'a list -> int * int

count_true_false p l returns a pair (int1,int2) where int1 is the number of elements in l that satisfy the predicate p, and int2 the number of elements that do not satisfy p.

since
2.4
val init : int -> (int -> 'a) -> 'a t

init len f is f 0; f 1; …; f (len-1).

raises Invalid_argument

if len < 0.

since
0.6
val combine : 'a list -> 'b list -> ('a * 'b) list

combine [a1; …; an] [b1; …; bn] is [(a1,b1); …; (an,bn)]. Transform two lists into a list of pairs. Like List.combine but tail-recursive.

raises Invalid_argument

if the lists have distinct lengths.

since
1.2, but only
since
2.2 with labels
val combine_gen : 'a list -> 'b list -> ('a * 'b) gen

combine_gen l1 l2 transforms two lists into a gen of pairs. Lazy version of combine. Unlike combine, it does not fail if the lists have different lengths; instead, the output has as many pairs as the smallest input list.

since
1.2, but only
since
2.2 with labels
val combine_shortest : 'a list -> 'b list -> ('a * 'b) list

combine_shortest [a1; …; am] [b1; …; bn] is [(a1,b1); …; (am,bm)] if m <= n. Like combine but stops at the shortest list rather than raising.

since
3.1
val split : ('a * 'b) t -> 'a t * 'b t

split [(a1,b1); …; (an,bn)] is ([a1; …; an], [b1; …; bn]). Transform a list of pairs into a pair of lists. A tail-recursive version of List.split.

since
1.2, but only
since
2.2 with labels
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare cmp l1 l2 compares the two lists l1 and l2 using the given comparison function cmp.

val compare_lengths : 'a t -> 'b t -> int

compare_lengths l1 l2 compare the lengths of the two lists l1 and l2. Equivalent to compare (length l1) (length l2) but more efficient.

since
1.5, but only
since
2.2 with labels
val compare_length_with : 'a t -> int -> int

compare_length_with l x compares the length of the list l to an integer x. Equivalent to compare (length l) x but more efficient.

since
1.5, but only
since
2.2 with labels
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal p l1 l2 returns true if l1 and l2 are equal.

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

flat_map f l maps and flattens at the same time (safe). Evaluation order is not guaranteed.

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

flat_map_i f l maps with index and flattens at the same time (safe). Evaluation order is not guaranteed.

since
2.8
val flatten : 'a t t -> 'a t

flatten [l1]; [l2]; … concatenates a list of lists. Safe version of List.flatten.

val product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

product comb l1 l2 computes the cartesian product of the two lists, with the given combinator comb.

val fold_product : ('c -> 'a -> 'b -> 'c) -> 'c -> 'a t -> 'b t -> 'c

fold_product f init l1 l2 applies the function f with the accumulator init on all the pair of elements of l1 and l2. Fold on the cartesian product.

val cartesian_product : 'a t t -> 'a t t

cartesian_product [[l1]; [l2]; …; [ln]] produces the cartesian product of this list of lists, by returning all the ways of picking one element per sublist. NOTE the order of the returned list is unspecified. For example:

# cartesian_product [[1;2];[3];[4;5;6]] |> sort =
+CCList (containers.CCList)

Module CCList

Complements to list

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

Fast internal iterator.

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

Documentation for the standard List module

include module type of Stdlib.List
type !'a t = 'a list =
| ([])
| (::) of 'a * 'a list
val length : 'a list -> int
val compare_lengths : 'a list -> 'b list -> int
val compare_length_with : 'a list -> int -> int
val cons : 'a -> 'a list -> 'a list
val hd : 'a list -> 'a
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val nth_opt : 'a list -> int -> 'a option
val rev : 'a list -> 'a list
val init : int -> (int -> 'a) -> 'a list
val append : 'a list -> 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
val flatten : 'a list list -> 'a list
val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool
val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int
val iter : ('a -> unit) -> 'a list -> unit
val iteri : (int -> 'a -> unit) -> 'a list -> unit
val map : ('a -> 'b) -> 'a list -> 'b list
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
val rev_map : ('a -> 'b) -> 'a list -> 'b list
val filter_map : ('a -> 'b option) -> 'a list -> 'b list
val concat_map : ('a -> 'b list) -> 'a list -> 'b list
val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a
val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit
val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a
val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
val for_all : ('a -> bool) -> 'a list -> bool
val exists : ('a -> bool) -> 'a list -> bool
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val mem : 'a -> 'a list -> bool
val memq : 'a -> 'a list -> bool
val find : ('a -> bool) -> 'a list -> 'a
val find_opt : ('a -> bool) -> 'a list -> 'a option
val find_map : ('a -> 'b option) -> 'a list -> 'b option
val filter : ('a -> bool) -> 'a list -> 'a list
val find_all : ('a -> bool) -> 'a list -> 'a list
val filteri : (int -> 'a -> bool) -> 'a list -> 'a list
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
val partition_map : ('a -> ('b'c) Stdlib.Either.t) -> 'a list -> 'b list * 'c list
val assoc : 'a -> ('a * 'b) list -> 'b
val assoc_opt : 'a -> ('a * 'b) list -> 'b option
val assq : 'a -> ('a * 'b) list -> 'b
val assq_opt : 'a -> ('a * 'b) list -> 'b option
val mem_assoc : 'a -> ('a * 'b) list -> bool
val mem_assq : 'a -> ('a * 'b) list -> bool
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val split : ('a * 'b) list -> 'a list * 'b list
val combine : 'a list -> 'b list -> ('a * 'b) list
val sort : ('a -> 'a -> int) -> 'a list -> 'a list
val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list
val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
val to_seq : 'a list -> 'a Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a list
type 'a t = 'a list
val empty : 'a t

empty is [].

val is_empty : _ t -> bool

is_empty l returns true iff l = [].

since
0.11
val map : ('a -> 'b) -> 'a t -> 'b t

map f [a0; a1; …; an] applies function f in turn to a0; a1; …; an. Safe version of List.map.

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

l >|= f is the infix version of map with reversed arguments.

since
0.5
val append : 'a t -> 'a t -> 'a t

append l1 l2 returns the list that is the concatenation of l1 and l2. Safe version of List.append.

val cons_maybe : 'a option -> 'a t -> 'a t

cons_maybe (Some x) l is x :: l. cons_maybe None l is l.

since
0.13
val cons' : 'a t -> 'a -> 'a t

cons' l x is the same as x :: l. This is convenient for fold functions such as List.fold_left or Array.fold_left.

since
3.3
val (@) : 'a t -> 'a t -> 'a t

l1 @ l2 is like append l1 l2. Concatenate the two lists l1 and l2.

val filter : ('a -> bool) -> 'a t -> 'a t

filter p l returns all the elements of the list l that satisfy the predicate p. The order of the elements in the input list l is preserved. Safe version of List.filter.

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

fold_right f [a1; …; an] b is f a1 (f a2 ( … (f an b) … )). Safe version of List.fold_right.

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

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

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

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

since
0.14
val fold_map_i : ('acc -> int -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list

fold_map_i f init l is a foldi-like function, but it also maps the list to another list.

since
2.8
val fold_on_map : f:('a -> 'b) -> reduce:('acc -> 'b -> 'acc) -> 'acc -> 'a list -> 'acc

fold_on_map ~f ~reduce init l combines map f and fold_left reduce init in one operation.

since
2.8
val scan_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc list

scan_left f init l returns the list [init; f init x0; f (f init x0) x1; …] where x0, x1, etc. are the elements of l.

since
1.2, but only
since
2.2 with labels
val reduce : ('a -> 'a -> 'a) -> 'a list -> 'a option

reduce f (hd::tl) returns Some (fold_left f hd tl). If l is empty, then None is returned.

since
3.2
val reduce_exn : ('a -> 'a -> 'a) -> 'a list -> 'a

reduce_exn is the unsafe version of reduce.

raises Invalid_argument

if the given list is empty.

since
3.2
val fold_map2 : ('acc -> 'a -> 'b -> 'acc * 'c) -> 'acc -> 'a list -> 'b list -> 'acc * 'c list

fold_map2 f init l1 l2 is to fold_map what List.map2 is to List.map.

raises Invalid_argument

if the lists do not have the same length.

since
0.16
val fold_filter_map : ('acc -> 'a -> 'acc * 'b option) -> 'acc -> 'a list -> 'acc * 'b list

fold_filter_map f init l is a fold_left-like function, but also generates a list of output in a way similar to filter_map.

since
0.17
val fold_filter_map_i : ('acc -> int -> 'a -> 'acc * 'b option) -> 'acc -> 'a list -> 'acc * 'b list

fold_filter_map_i f init l is a foldi-like function, but also generates a list of output in a way similar to filter_map.

since
2.8
val fold_flat_map : ('acc -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * 'b list

fold_flat_map f init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

since
0.14
val fold_flat_map_i : ('acc -> int -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * 'b list

fold_flat_map_i f init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

since
2.8
val count : ('a -> bool) -> 'a list -> int

count p l counts how many elements of l satisfy predicate p.

since
1.5, but only
since
2.2 with labels
val count_true_false : ('a -> bool) -> 'a list -> int * int

count_true_false p l returns a pair (int1,int2) where int1 is the number of elements in l that satisfy the predicate p, and int2 the number of elements that do not satisfy p.

since
2.4
val init : int -> (int -> 'a) -> 'a t

init len f is f 0; f 1; …; f (len-1).

raises Invalid_argument

if len < 0.

since
0.6
val combine : 'a list -> 'b list -> ('a * 'b) list

combine [a1; …; an] [b1; …; bn] is [(a1,b1); …; (an,bn)]. Transform two lists into a list of pairs. Like List.combine but tail-recursive.

raises Invalid_argument

if the lists have distinct lengths.

since
1.2, but only
since
2.2 with labels
val combine_gen : 'a list -> 'b list -> ('a * 'b) gen

combine_gen l1 l2 transforms two lists into a gen of pairs. Lazy version of combine. Unlike combine, it does not fail if the lists have different lengths; instead, the output has as many pairs as the smallest input list.

since
1.2, but only
since
2.2 with labels
val combine_shortest : 'a list -> 'b list -> ('a * 'b) list

combine_shortest [a1; …; am] [b1; …; bn] is [(a1,b1); …; (am,bm)] if m <= n. Like combine but stops at the shortest list rather than raising.

since
3.1
val split : ('a * 'b) t -> 'a t * 'b t

split [(a1,b1); …; (an,bn)] is ([a1; …; an], [b1; …; bn]). Transform a list of pairs into a pair of lists. A tail-recursive version of List.split.

since
1.2, but only
since
2.2 with labels
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare cmp l1 l2 compares the two lists l1 and l2 using the given comparison function cmp.

val compare_lengths : 'a t -> 'b t -> int

compare_lengths l1 l2 compare the lengths of the two lists l1 and l2. Equivalent to compare (length l1) (length l2) but more efficient.

since
1.5, but only
since
2.2 with labels
val compare_length_with : 'a t -> int -> int

compare_length_with l x compares the length of the list l to an integer x. Equivalent to compare (length l) x but more efficient.

since
1.5, but only
since
2.2 with labels
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal p l1 l2 returns true if l1 and l2 are equal.

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

flat_map f l maps and flattens at the same time (safe). Evaluation order is not guaranteed.

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

flat_map_i f l maps with index and flattens at the same time (safe). Evaluation order is not guaranteed.

since
2.8
val flatten : 'a t t -> 'a t

flatten [l1]; [l2]; … concatenates a list of lists. Safe version of List.flatten.

val product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

product comb l1 l2 computes the cartesian product of the two lists, with the given combinator comb.

val fold_product : ('c -> 'a -> 'b -> 'c) -> 'c -> 'a t -> 'b t -> 'c

fold_product f init l1 l2 applies the function f with the accumulator init on all the pair of elements of l1 and l2. Fold on the cartesian product.

val cartesian_product : 'a t t -> 'a t t

cartesian_product [[l1]; [l2]; …; [ln]] produces the cartesian product of this list of lists, by returning all the ways of picking one element per sublist. NOTE the order of the returned list is unspecified. For example:

# cartesian_product [[1;2];[3];[4;5;6]] |> sort =
 [[1;3;4];[1;3;5];[1;3;6];[2;3;4];[2;3;5];[2;3;6]];;
 # cartesian_product [[1;2];[];[4;5;6]] = [];;
 # cartesian_product [[1;2];[3];[4];[5];[6]] |> sort =
diff --git a/dev/containers/CCListLabels/index.html b/dev/containers/CCListLabels/index.html
index 7374ce3b..b556b695 100644
--- a/dev/containers/CCListLabels/index.html
+++ b/dev/containers/CCListLabels/index.html
@@ -1,5 +1,5 @@
 
-CCListLabels (containers.CCListLabels)

Module CCListLabels

Complements to list

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

Fast internal iterator.

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

Documentation for the standard ListLabels module

include module type of Stdlib.ListLabels
type !'a t = 'a list =
| ([])
| (::) of 'a * 'a list
val length : 'a list -> int
val hd : 'a list -> 'a
val compare_lengths : 'a list -> 'b list -> int
val compare_length_with : 'a list -> len:int -> int
val cons : 'a -> 'a list -> 'a list
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val nth_opt : 'a list -> int -> 'a option
val rev : 'a list -> 'a list
val init : len:int -> f:(int -> 'a) -> 'a list
val append : 'a list -> 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
val flatten : 'a list list -> 'a list
val iter : f:('a -> unit) -> 'a list -> unit
val iteri : f:(int -> 'a -> unit) -> 'a list -> unit
val map : f:('a -> 'b) -> 'a list -> 'b list
val mapi : f:(int -> 'a -> 'b) -> 'a list -> 'b list
val rev_map : f:('a -> 'b) -> 'a list -> 'b list
val filter_map : f:('a -> 'b option) -> 'a list -> 'b list
val concat_map : f:('a -> 'b list) -> 'a list -> 'b list
val fold_left_map : f:('a -> 'b -> 'a * 'c) -> init:'a -> 'b list -> 'a * 'c list
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b list -> 'a
val fold_right : f:('a -> 'b -> 'b) -> 'a list -> init:'b -> 'b
val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit
val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val fold_left2 : f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a
val fold_right2 : f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c
val for_all : f:('a -> bool) -> 'a list -> bool
val exists : f:('a -> bool) -> 'a list -> bool
val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val mem : 'a -> set:'a list -> bool
val memq : 'a -> set:'a list -> bool
val find : f:('a -> bool) -> 'a list -> 'a
val find_opt : f:('a -> bool) -> 'a list -> 'a option
val find_map : f:('a -> 'b option) -> 'a list -> 'b option
val filter : f:('a -> bool) -> 'a list -> 'a list
val find_all : f:('a -> bool) -> 'a list -> 'a list
val filteri : f:(int -> 'a -> bool) -> 'a list -> 'a list
val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list
val assoc : 'a -> ('a * 'b) list -> 'b
val assoc_opt : 'a -> ('a * 'b) list -> 'b option
val assq : 'a -> ('a * 'b) list -> 'b
val assq_opt : 'a -> ('a * 'b) list -> 'b option
val mem_assoc : 'a -> map:('a * 'b) list -> bool
val mem_assq : 'a -> map:('a * 'b) list -> bool
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val split : ('a * 'b) list -> 'a list * 'b list
val combine : 'a list -> 'b list -> ('a * 'b) list
val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list
val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
val to_seq : 'a list -> 'a Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a list
type 'a t = 'a list
val empty : 'a t

empty is [].

val is_empty : _ t -> bool

is_empty l returns true iff l = [].

since
0.11
val map : f:('a -> 'b) -> 'a t -> 'b t

map ~f [a0; a1; …; an] applies function f in turn to [a0; a1; …; an]. Safe version of List.map.

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

l >|= f is the infix version of map with reversed arguments.

since
0.5
val cons : 'a -> 'a t -> 'a t

cons x l is x::l.

since
0.12
val append : 'a t -> 'a t -> 'a t

append l1 l2 returns the list that is the concatenation of l1 and l2. Safe version of List.append.

val cons' : 'a t -> 'a -> 'a t

cons' l x is the same as x :: l. This is convenient for fold functions such as List.fold_left or Array.fold_left.

since
3.3
val cons_maybe : 'a option -> 'a t -> 'a t

cons_maybe (Some x) l is x :: l. cons_maybe None l is l.

since
0.13
val (@) : 'a t -> 'a t -> 'a t

l1 @ l2 is like append l1 l2. Concatenate the two lists l1 and l2.

val filter : f:('a -> bool) -> 'a t -> 'a t

filter ~f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list l is preserved. Safe version of List.filter.

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

fold_right ~f [a1; …; an] ~init is f a1 (f a2 ( … (f an init) … )). Safe version of List.fold_right.

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

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

since
0.8
val fold_map : f:('acc -> 'a -> 'acc * 'b) -> init:'acc -> 'a list -> 'acc * 'b list

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

since
0.14
val fold_map_i : f:('acc -> int -> 'a -> 'acc * 'b) -> init:'acc -> 'a list -> 'acc * 'b list

fold_map_i ~f ~init l is a foldi-like function, but it also maps the list to another list.

since
2.8
val fold_on_map : f:('a -> 'b) -> reduce:('acc -> 'b -> 'acc) -> init:'acc -> 'a list -> 'acc

fold_on_map ~f ~reduce ~init l combines map ~f and fold_left ~reduce ~init in one operation.

since
2.8
val scan_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a list -> 'acc list

scan_left ~f ~init l returns the list [init; f init x0; f (f init x0) x1; …] where x0, x1, etc. are the elements of l.

since
1.2, but only
since
2.2 with labels
val reduce : f:('a -> 'a -> 'a) -> 'a list -> 'a option

reduce f (hd::tl) returns Some (fold_left f hd tl). If l is empty, then None is returned.

since
3.2
val reduce_exn : f:('a -> 'a -> 'a) -> 'a list -> 'a

reduce_exn is the unsafe version of reduce.

raises Invalid_argument

if the given list is empty.

since
3.2
val fold_map2 : f:('acc -> 'a -> 'b -> 'acc * 'c) -> init:'acc -> 'a list -> 'b list -> 'acc * 'c list

fold_map2 ~f ~init l1 l2 is to fold_map what List.map2 is to List.map.

raises Invalid_argument

if the lists do not have the same length.

since
0.16
val fold_filter_map : f:('acc -> 'a -> 'acc * 'b option) -> init:'acc -> 'a list -> 'acc * 'b list

fold_filter_map ~f ~init l is a fold_left-like function, but also generates a list of output in a way similar to filter_map.

since
0.17
val fold_filter_map_i : f:('acc -> int -> 'a -> 'acc * 'b option) -> init:'acc -> 'a list -> 'acc * 'b list

fold_filter_map_i ~f ~init l is a foldi-like function, but also generates a list of output in a way similar to filter_map.

since
2.8
val fold_flat_map : f:('acc -> 'a -> 'acc * 'b list) -> init:'acc -> 'a list -> 'acc * 'b list

fold_flat_map ~f ~init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

since
0.14
val fold_flat_map_i : f:('acc -> int -> 'a -> 'acc * 'b list) -> init:'acc -> 'a list -> 'acc * 'b list

fold_flat_map_i ~f ~init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

since
2.8
val count : f:('a -> bool) -> 'a list -> int

count ~f l counts how many elements of l satisfy predicate f.

since
1.5, but only
since
2.2 with labels
val count_true_false : f:('a -> bool) -> 'a list -> int * int

count_true_false ~f l returns a pair (int1,int2) where int1 is the number of elements in l that satisfy the predicate f, and int2 the number of elements that do not satisfy f.

since
2.4
val init : int -> f:(int -> 'a) -> 'a t

init len ~f is f 0; f 1; …; f (len-1).

raises Invalid_argument

if len < 0.

since
0.6
val combine : 'a list -> 'b list -> ('a * 'b) list

combine [a1; …; an] [b1; …; bn] is [(a1,b1); …; (an,bn)]. Transform two lists into a list of pairs. Like List.combine but tail-recursive.

raises Invalid_argument

if the lists have distinct lengths.

since
1.2, but only
since
2.2 with labels
val combine_gen : 'a list -> 'b list -> ('a * 'b) gen

combine_gen l1 l2 transforms two lists into a gen of pairs. Lazy version of combine. Unlike combine, it does not fail if the lists have different lengths; instead, the output has as many pairs as the smallest input list.

since
1.2, but only
since
2.2 with labels
val combine_shortest : 'a list -> 'b list -> ('a * 'b) list

combine_shortest [a1; …; am] [b1; …; bn] is [(a1,b1); …; (am,bm)] if m <= n. Like combine but stops at the shortest list rather than raising.

since
3.1
val split : ('a * 'b) t -> 'a t * 'b t

split [(a1,b1); …; (an,bn)] is ([a1; …; an], [b1; …; bn]). Transform a list of pairs into a pair of lists. A tail-recursive version of List.split.

since
1.2, but only
since
2.2 with labels
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare cmp l1 l2 compares the two lists l1 and l2 using the given comparison function cmp.

val compare_lengths : 'a t -> 'b t -> int

compare_lengths l1 l2 compare the lengths of the two lists l1 and l2. Equivalent to compare (length l1) (length l2) but more efficient.

since
1.5, but only
since
2.2 with labels
val compare_length_with : 'a t -> int -> int

compare_length_with l x compares the length of the list l to an integer x. Equivalent to compare (length l) x but more efficient.

since
1.5, but only
since
2.2 with labels
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal p l1 l2 returns true if l1 and l2 are equal.

val flat_map : f:('a -> 'b t) -> 'a t -> 'b t

flat_map ~f l maps and flattens at the same time (safe). Evaluation order is not guaranteed.

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

flat_map_i ~f l maps with index and flattens at the same time (safe). Evaluation order is not guaranteed.

since
2.8
val flatten : 'a t t -> 'a t

flatten [l1]; [l2]; … concatenates a list of lists. Safe version of List.flatten.

val product : f:('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

product ~f l1 l2 computes the cartesian product of the two lists, with the given combinator f.

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

fold_product ~f ~init l1 l2 applies the function f with the accumulator init on all the pair of elements of l1 and l2. Fold on the cartesian product.

val cartesian_product : 'a t t -> 'a t t

cartesian_product [[l1];[l2]; …; [ln]] produces the cartesian product of this list of lists, by returning all the ways of picking one element per sublist. NOTE the order of the returned list is unspecified. For example:

# cartesian_product [[1;2];[3];[4;5;6]] |> sort =
+CCListLabels (containers.CCListLabels)

Module CCListLabels

Complements to list

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

Fast internal iterator.

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

Documentation for the standard ListLabels module

include module type of Stdlib.ListLabels
type !'a t = 'a list =
| ([])
| (::) of 'a * 'a list
val length : 'a list -> int
val compare_lengths : 'a list -> 'b list -> int
val compare_length_with : 'a list -> len:int -> int
val cons : 'a -> 'a list -> 'a list
val hd : 'a list -> 'a
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val nth_opt : 'a list -> int -> 'a option
val rev : 'a list -> 'a list
val init : len:int -> f:(int -> 'a) -> 'a list
val append : 'a list -> 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
val flatten : 'a list list -> 'a list
val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool
val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int
val iter : f:('a -> unit) -> 'a list -> unit
val iteri : f:(int -> 'a -> unit) -> 'a list -> unit
val map : f:('a -> 'b) -> 'a list -> 'b list
val mapi : f:(int -> 'a -> 'b) -> 'a list -> 'b list
val rev_map : f:('a -> 'b) -> 'a list -> 'b list
val filter_map : f:('a -> 'b option) -> 'a list -> 'b list
val concat_map : f:('a -> 'b list) -> 'a list -> 'b list
val fold_left_map : f:('a -> 'b -> 'a * 'c) -> init:'a -> 'b list -> 'a * 'c list
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b list -> 'a
val fold_right : f:('a -> 'b -> 'b) -> 'a list -> init:'b -> 'b
val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit
val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val fold_left2 : f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a
val fold_right2 : f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c
val for_all : f:('a -> bool) -> 'a list -> bool
val exists : f:('a -> bool) -> 'a list -> bool
val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val mem : 'a -> set:'a list -> bool
val memq : 'a -> set:'a list -> bool
val find : f:('a -> bool) -> 'a list -> 'a
val find_opt : f:('a -> bool) -> 'a list -> 'a option
val find_map : f:('a -> 'b option) -> 'a list -> 'b option
val filter : f:('a -> bool) -> 'a list -> 'a list
val find_all : f:('a -> bool) -> 'a list -> 'a list
val filteri : f:(int -> 'a -> bool) -> 'a list -> 'a list
val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list
val partition_map : f:('a -> ('b'c) Stdlib.Either.t) -> 'a list -> 'b list * 'c list
val assoc : 'a -> ('a * 'b) list -> 'b
val assoc_opt : 'a -> ('a * 'b) list -> 'b option
val assq : 'a -> ('a * 'b) list -> 'b
val assq_opt : 'a -> ('a * 'b) list -> 'b option
val mem_assoc : 'a -> map:('a * 'b) list -> bool
val mem_assq : 'a -> map:('a * 'b) list -> bool
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val split : ('a * 'b) list -> 'a list * 'b list
val combine : 'a list -> 'b list -> ('a * 'b) list
val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list
val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
val to_seq : 'a list -> 'a Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a list
type 'a t = 'a list
val empty : 'a t

empty is [].

val is_empty : _ t -> bool

is_empty l returns true iff l = [].

since
0.11
val map : f:('a -> 'b) -> 'a t -> 'b t

map ~f [a0; a1; …; an] applies function f in turn to [a0; a1; …; an]. Safe version of List.map.

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

l >|= f is the infix version of map with reversed arguments.

since
0.5
val cons : 'a -> 'a t -> 'a t

cons x l is x::l.

since
0.12
val append : 'a t -> 'a t -> 'a t

append l1 l2 returns the list that is the concatenation of l1 and l2. Safe version of List.append.

val cons' : 'a t -> 'a -> 'a t

cons' l x is the same as x :: l. This is convenient for fold functions such as List.fold_left or Array.fold_left.

since
3.3
val cons_maybe : 'a option -> 'a t -> 'a t

cons_maybe (Some x) l is x :: l. cons_maybe None l is l.

since
0.13
val (@) : 'a t -> 'a t -> 'a t

l1 @ l2 is like append l1 l2. Concatenate the two lists l1 and l2.

val filter : f:('a -> bool) -> 'a t -> 'a t

filter ~f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list l is preserved. Safe version of List.filter.

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

fold_right ~f [a1; …; an] ~init is f a1 (f a2 ( … (f an init) … )). Safe version of List.fold_right.

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

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

since
0.8
val fold_map : f:('acc -> 'a -> 'acc * 'b) -> init:'acc -> 'a list -> 'acc * 'b list

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

since
0.14
val fold_map_i : f:('acc -> int -> 'a -> 'acc * 'b) -> init:'acc -> 'a list -> 'acc * 'b list

fold_map_i ~f ~init l is a foldi-like function, but it also maps the list to another list.

since
2.8
val fold_on_map : f:('a -> 'b) -> reduce:('acc -> 'b -> 'acc) -> init:'acc -> 'a list -> 'acc

fold_on_map ~f ~reduce ~init l combines map ~f and fold_left ~reduce ~init in one operation.

since
2.8
val scan_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a list -> 'acc list

scan_left ~f ~init l returns the list [init; f init x0; f (f init x0) x1; …] where x0, x1, etc. are the elements of l.

since
1.2, but only
since
2.2 with labels
val reduce : f:('a -> 'a -> 'a) -> 'a list -> 'a option

reduce f (hd::tl) returns Some (fold_left f hd tl). If l is empty, then None is returned.

since
3.2
val reduce_exn : f:('a -> 'a -> 'a) -> 'a list -> 'a

reduce_exn is the unsafe version of reduce.

raises Invalid_argument

if the given list is empty.

since
3.2
val fold_map2 : f:('acc -> 'a -> 'b -> 'acc * 'c) -> init:'acc -> 'a list -> 'b list -> 'acc * 'c list

fold_map2 ~f ~init l1 l2 is to fold_map what List.map2 is to List.map.

raises Invalid_argument

if the lists do not have the same length.

since
0.16
val fold_filter_map : f:('acc -> 'a -> 'acc * 'b option) -> init:'acc -> 'a list -> 'acc * 'b list

fold_filter_map ~f ~init l is a fold_left-like function, but also generates a list of output in a way similar to filter_map.

since
0.17
val fold_filter_map_i : f:('acc -> int -> 'a -> 'acc * 'b option) -> init:'acc -> 'a list -> 'acc * 'b list

fold_filter_map_i ~f ~init l is a foldi-like function, but also generates a list of output in a way similar to filter_map.

since
2.8
val fold_flat_map : f:('acc -> 'a -> 'acc * 'b list) -> init:'acc -> 'a list -> 'acc * 'b list

fold_flat_map ~f ~init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

since
0.14
val fold_flat_map_i : f:('acc -> int -> 'a -> 'acc * 'b list) -> init:'acc -> 'a list -> 'acc * 'b list

fold_flat_map_i ~f ~init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

since
2.8
val count : f:('a -> bool) -> 'a list -> int

count ~f l counts how many elements of l satisfy predicate f.

since
1.5, but only
since
2.2 with labels
val count_true_false : f:('a -> bool) -> 'a list -> int * int

count_true_false ~f l returns a pair (int1,int2) where int1 is the number of elements in l that satisfy the predicate f, and int2 the number of elements that do not satisfy f.

since
2.4
val init : int -> f:(int -> 'a) -> 'a t

init len ~f is f 0; f 1; …; f (len-1).

raises Invalid_argument

if len < 0.

since
0.6
val combine : 'a list -> 'b list -> ('a * 'b) list

combine [a1; …; an] [b1; …; bn] is [(a1,b1); …; (an,bn)]. Transform two lists into a list of pairs. Like List.combine but tail-recursive.

raises Invalid_argument

if the lists have distinct lengths.

since
1.2, but only
since
2.2 with labels
val combine_gen : 'a list -> 'b list -> ('a * 'b) gen

combine_gen l1 l2 transforms two lists into a gen of pairs. Lazy version of combine. Unlike combine, it does not fail if the lists have different lengths; instead, the output has as many pairs as the smallest input list.

since
1.2, but only
since
2.2 with labels
val combine_shortest : 'a list -> 'b list -> ('a * 'b) list

combine_shortest [a1; …; am] [b1; …; bn] is [(a1,b1); …; (am,bm)] if m <= n. Like combine but stops at the shortest list rather than raising.

since
3.1
val split : ('a * 'b) t -> 'a t * 'b t

split [(a1,b1); …; (an,bn)] is ([a1; …; an], [b1; …; bn]). Transform a list of pairs into a pair of lists. A tail-recursive version of List.split.

since
1.2, but only
since
2.2 with labels
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare cmp l1 l2 compares the two lists l1 and l2 using the given comparison function cmp.

val compare_lengths : 'a t -> 'b t -> int

compare_lengths l1 l2 compare the lengths of the two lists l1 and l2. Equivalent to compare (length l1) (length l2) but more efficient.

since
1.5, but only
since
2.2 with labels
val compare_length_with : 'a t -> int -> int

compare_length_with l x compares the length of the list l to an integer x. Equivalent to compare (length l) x but more efficient.

since
1.5, but only
since
2.2 with labels
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal p l1 l2 returns true if l1 and l2 are equal.

val flat_map : f:('a -> 'b t) -> 'a t -> 'b t

flat_map ~f l maps and flattens at the same time (safe). Evaluation order is not guaranteed.

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

flat_map_i ~f l maps with index and flattens at the same time (safe). Evaluation order is not guaranteed.

since
2.8
val flatten : 'a t t -> 'a t

flatten [l1]; [l2]; … concatenates a list of lists. Safe version of List.flatten.

val product : f:('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

product ~f l1 l2 computes the cartesian product of the two lists, with the given combinator f.

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

fold_product ~f ~init l1 l2 applies the function f with the accumulator init on all the pair of elements of l1 and l2. Fold on the cartesian product.

val cartesian_product : 'a t t -> 'a t t

cartesian_product [[l1];[l2]; …; [ln]] produces the cartesian product of this list of lists, by returning all the ways of picking one element per sublist. NOTE the order of the returned list is unspecified. For example:

# cartesian_product [[1;2];[3];[4;5;6]] |> sort =
 [[1;3;4];[1;3;5];[1;3;6];[2;3;4];[2;3;5];[2;3;6]];;
 # cartesian_product [[1;2];[];[4;5;6]] = [];;
 # cartesian_product [[1;2];[3];[4];[5];[6]] |> sort =
diff --git a/dev/containers/CCMap/module-type-S/index.html b/dev/containers/CCMap/module-type-S/index.html
index bdddec8b..97c2af90 100644
--- a/dev/containers/CCMap/module-type-S/index.html
+++ b/dev/containers/CCMap/module-type-S/index.html
@@ -1,2 +1,2 @@
 
-S (containers.CCMap.S)

Module type CCMap.S

include Stdlib.Map.S
type key
type +'a t
val empty : 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val split : key -> 'a t -> 'a t * 'a option * 'a t
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : key -> 'a t -> 'a option

get k m returns Some v if the current binding of k in m is v, or None if the key k is not present. Safe version of find.

val get_or : key -> 'a t -> default:'a -> 'a

get_or k m ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in m).

since
0.16
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update k f m calls f (Some v) if find k m = v, otherwise it calls f None. In any case, if the result is None k is removed from m, and if the result is Some v' then add k v' m is returned.

val choose_opt : 'a t -> (key * 'a) option

choose_opt m returns one binding of the given map m, or None if m is empty. Safe version of choose.

since
1.5
val min_binding_opt : 'a t -> (key * 'a) option

min_binding_opt m returns the smallest binding of the given map m, or None if m is empty. Safe version of min_binding.

since
1.5
val max_binding_opt : 'a t -> (key * 'a) option

max_binding_opt m returns the largest binding of the given map m, or None if m is empty. Safe version of max_binding.

since
1.5
val find_opt : key -> 'a t -> 'a option

find_opt k m returns Some v if the current binding of k in m is v, or None if the key k is not present. Safe version of find.

since
1.5
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists. See Map.S.find_first.

since
1.5
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists. Safe version of find_first.

since
1.5
val merge_safe : f:(key -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option) -> 'a t -> 'b t -> 'c t

merge_safe ~f a b merges the maps a and b together.

since
0.17
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> 'a t

add_seq m seq adds the given Seq.t of bindings to the map m. Like add_list. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> 'a t

add_seq ~f m l adds the given seq l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

since
3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

of_seq seq builds a map from the given Seq.t of bindings. Like of_list. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a t

of_seq_with ~f l builds a map from the given seq l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

since
3.3
val add_iter : 'a t -> (key * 'a) iter -> 'a t

add_iter m iter adds the given iter of bindings to the map m. Like add_list.

since
2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) iter -> 'a t

add_iter ~f m l adds the given iter l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

since
3.3
val of_iter : (key * 'a) iter -> 'a t

of_iter iter builds a map from the given iter of bindings. Like of_list.

since
2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) iter -> 'a t

of_iter_with ~f l builds a map from the given iter l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the iter than v2.

since
3.3
val to_iter : 'a t -> (key * 'a) iter

to_iter m iterates on the whole map m, creating an iter of bindings. Like to_list.

since
2.8
val of_list : (key * 'a) list -> 'a t

of_list l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, only its last binding will be present in the result.

val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a t

of_list_with ~f l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the list than v2.

since
3.3
val add_list : 'a t -> (key * 'a) list -> 'a t

add_list m l adds the given list l of bindings to the map m.

since
0.14
val add_list_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) list -> 'a t

add_list ~f m l adds the given list l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

since
3.3
val keys : _ t -> key iter

keys m iterates on the keys of m only, creating an iter of keys.

since
0.15
val values : 'a t -> 'a iter

values m iterates on the values of m only, creating an iter of values.

since
0.15
val to_list : 'a t -> (key * 'a) list

to_list m builds a list of the bindings of the given map m. The order is unspecified.

val pp : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_arrow:unit printer -> ?⁠pp_sep:unit printer -> key printer -> 'a printer -> 'a t printer

pp ?pp_start ?pp_stop ?pp_arrow ?pp_sep pp_key pp_v m pretty-prints the contents of the map.

\ No newline at end of file +S (containers.CCMap.S)

Module type CCMap.S

include Stdlib.Map.S
type key
type !+'a t
val empty : 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val split : key -> 'a t -> 'a t * 'a option * 'a t
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : key -> 'a t -> 'a option

get k m returns Some v if the current binding of k in m is v, or None if the key k is not present. Safe version of find.

val get_or : key -> 'a t -> default:'a -> 'a

get_or k m ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in m).

since
0.16
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update k f m calls f (Some v) if find k m = v, otherwise it calls f None. In any case, if the result is None k is removed from m, and if the result is Some v' then add k v' m is returned.

val choose_opt : 'a t -> (key * 'a) option

choose_opt m returns one binding of the given map m, or None if m is empty. Safe version of choose.

since
1.5
val min_binding_opt : 'a t -> (key * 'a) option

min_binding_opt m returns the smallest binding of the given map m, or None if m is empty. Safe version of min_binding.

since
1.5
val max_binding_opt : 'a t -> (key * 'a) option

max_binding_opt m returns the largest binding of the given map m, or None if m is empty. Safe version of max_binding.

since
1.5
val find_opt : key -> 'a t -> 'a option

find_opt k m returns Some v if the current binding of k in m is v, or None if the key k is not present. Safe version of find.

since
1.5
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists. See Map.S.find_first.

since
1.5
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists. Safe version of find_first.

since
1.5
val merge_safe : f:(key -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option) -> 'a t -> 'b t -> 'c t

merge_safe ~f a b merges the maps a and b together.

since
0.17
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> 'a t

add_seq m seq adds the given Seq.t of bindings to the map m. Like add_list. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> 'a t

add_seq ~f m l adds the given seq l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

since
3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

of_seq seq builds a map from the given Seq.t of bindings. Like of_list. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a t

of_seq_with ~f l builds a map from the given seq l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

since
3.3
val add_iter : 'a t -> (key * 'a) iter -> 'a t

add_iter m iter adds the given iter of bindings to the map m. Like add_list.

since
2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) iter -> 'a t

add_iter ~f m l adds the given iter l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

since
3.3
val of_iter : (key * 'a) iter -> 'a t

of_iter iter builds a map from the given iter of bindings. Like of_list.

since
2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) iter -> 'a t

of_iter_with ~f l builds a map from the given iter l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the iter than v2.

since
3.3
val to_iter : 'a t -> (key * 'a) iter

to_iter m iterates on the whole map m, creating an iter of bindings. Like to_list.

since
2.8
val of_list : (key * 'a) list -> 'a t

of_list l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, only its last binding will be present in the result.

val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a t

of_list_with ~f l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the list than v2.

since
3.3
val add_list : 'a t -> (key * 'a) list -> 'a t

add_list m l adds the given list l of bindings to the map m.

since
0.14
val add_list_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) list -> 'a t

add_list ~f m l adds the given list l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

since
3.3
val keys : _ t -> key iter

keys m iterates on the keys of m only, creating an iter of keys.

since
0.15
val values : 'a t -> 'a iter

values m iterates on the values of m only, creating an iter of values.

since
0.15
val to_list : 'a t -> (key * 'a) list

to_list m builds a list of the bindings of the given map m. The order is unspecified.

val pp : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_arrow:unit printer -> ?⁠pp_sep:unit printer -> key printer -> 'a printer -> 'a t printer

pp ?pp_start ?pp_stop ?pp_arrow ?pp_sep pp_key pp_v m pretty-prints the contents of the map.

\ No newline at end of file diff --git a/dev/containers/CCSet/module-type-S/index.html b/dev/containers/CCSet/module-type-S/index.html index c8aa9a5f..6da35737 100644 --- a/dev/containers/CCSet/module-type-S/index.html +++ b/dev/containers/CCSet/module-type-S/index.html @@ -1,2 +1,2 @@ -S (containers.CCSet.S)

Module type CCSet.S

include Stdlib.Set.S
type elt
type t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val compare : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val iter : (elt -> unit) -> t -> unit
val map : (elt -> elt) -> t -> t
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val split : elt -> t -> t * bool * t
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val of_list : elt list -> t
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_seq : elt Stdlib.Seq.t -> t
val min_elt_opt : t -> elt option

Safe version of min_elt.

since
1.5
val max_elt_opt : t -> elt option

Safe version of max_elt.

since
1.5
val choose_opt : t -> elt option

Safe version of choose.

since
1.5
val find_opt : elt -> t -> elt option

Safe version of find.

since
1.5
val find_first : (elt -> bool) -> t -> elt

Find minimum element satisfying predicate.

since
1.5
val find_first_opt : (elt -> bool) -> t -> elt option

Safe version of find_first.

since
1.5
val find_last : (elt -> bool) -> t -> elt

Find maximum element satisfying predicate.

since
1.5
val find_last_opt : (elt -> bool) -> t -> elt option

Safe version of find_last.

since
1.5
val of_iter : elt iter -> t

Build a set from the given iter of elements.

since
2.8
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given seq of elements.

since
3.0
val add_iter : t -> elt iter -> t
since
2.8
val add_seq : elt Stdlib.Seq.t -> t -> t
since
3.0
val to_iter : t -> elt iter

to_iter t converts the set t to a iter of the elements.

since
2.8
val add_list : t -> elt list -> t
since
0.14
val to_list : t -> elt list

to_list t converts the set t to a list of the elements.

val to_string : ?⁠start:string -> ?⁠stop:string -> ?⁠sep:string -> (elt -> string) -> t -> string

Print the set in a string

since
2.7
val pp : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_sep:unit printer -> elt printer -> t printer

Print the set.

\ No newline at end of file +S (containers.CCSet.S)

Module type CCSet.S

include Stdlib.Set.S
type elt
type t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val compare : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val iter : (elt -> unit) -> t -> unit
val map : (elt -> elt) -> t -> t
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val split : elt -> t -> t * bool * t
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val of_list : elt list -> t
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_seq : t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_seq : elt Stdlib.Seq.t -> t
val min_elt_opt : t -> elt option

Safe version of min_elt.

since
1.5
val max_elt_opt : t -> elt option

Safe version of max_elt.

since
1.5
val choose_opt : t -> elt option

Safe version of choose.

since
1.5
val find_opt : elt -> t -> elt option

Safe version of find.

since
1.5
val find_first : (elt -> bool) -> t -> elt

Find minimum element satisfying predicate.

since
1.5
val find_first_opt : (elt -> bool) -> t -> elt option

Safe version of find_first.

since
1.5
val find_last : (elt -> bool) -> t -> elt

Find maximum element satisfying predicate.

since
1.5
val find_last_opt : (elt -> bool) -> t -> elt option

Safe version of find_last.

since
1.5
val of_iter : elt iter -> t

Build a set from the given iter of elements.

since
2.8
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given seq of elements.

since
3.0
val add_iter : t -> elt iter -> t
since
2.8
val add_seq : elt Stdlib.Seq.t -> t -> t
since
3.0
val to_iter : t -> elt iter

to_iter t converts the set t to a iter of the elements.

since
2.8
val add_list : t -> elt list -> t
since
0.14
val to_list : t -> elt list

to_list t converts the set t to a list of the elements.

val to_string : ?⁠start:string -> ?⁠stop:string -> ?⁠sep:string -> (elt -> string) -> t -> string

Print the set in a string

since
2.7
val pp : ?⁠pp_start:unit printer -> ?⁠pp_stop:unit printer -> ?⁠pp_sep:unit printer -> elt printer -> t printer

Print the set.

\ No newline at end of file diff --git a/dev/containers/CCShimsArrayLabels_/index.html b/dev/containers/CCShimsArrayLabels_/index.html index 00e34c44..dd75fe7a 100644 --- a/dev/containers/CCShimsArrayLabels_/index.html +++ b/dev/containers/CCShimsArrayLabels_/index.html @@ -1,2 +1,2 @@ -CCShimsArrayLabels_ (containers.CCShimsArrayLabels_)

Module CCShimsArrayLabels_

Documentation for the standard ArrayLabels module

include module type of Stdlib.ArrayLabels with module CCShimsArrayLabels_.Floatarray = Stdlib.Array.Floatarray
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 init : int -> f:(int -> 'a) -> 'a array
val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val append : 'a array -> 'a array -> 'a array
val concat : 'a array list -> 'a array
val sub : 'a array -> pos:int -> len:int -> 'a array
val copy : 'a array -> 'a array
val fill : 'a array -> pos:int -> len:int -> 'a -> unit
val blit : src:'a array -> src_pos:int -> dst:'a array -> dst_pos:int -> len:int -> unit
val to_list : 'a array -> 'a list
val of_list : 'a list -> 'a array
val iter : f:('a -> unit) -> 'a array -> unit
val map : f:('a -> 'b) -> 'a array -> 'b array
val iteri : f:(int -> 'a -> unit) -> 'a array -> unit
val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b array -> 'a
val fold_right : f:('b -> 'a -> 'a) -> 'b array -> init:'a -> 'a
val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit
val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
val exists : f:('a -> bool) -> 'a array -> bool
val for_all : f:('a -> bool) -> 'a array -> bool
val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val mem : 'a -> set:'a array -> bool
val memq : 'a -> set:'a array -> bool
val create_float : int -> float array
val make_float : int -> float 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_seq : 'a array -> 'a Stdlib.Seq.t
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
\ No newline at end of file +CCShimsArrayLabels_ (containers.CCShimsArrayLabels_)

Module CCShimsArrayLabels_

Documentation for the standard ArrayLabels module

include module type of Stdlib.ArrayLabels with module CCShimsArrayLabels_.Floatarray = Stdlib.Array.Floatarray
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 -> f:(int -> 'a) -> 'a array
val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val append : 'a array -> 'a array -> 'a array
val concat : 'a array list -> 'a array
val sub : 'a array -> pos:int -> len:int -> 'a array
val copy : 'a array -> 'a array
val fill : 'a array -> pos:int -> len:int -> 'a -> unit
val blit : src:'a array -> src_pos:int -> dst:'a array -> dst_pos:int -> len:int -> unit
val to_list : 'a array -> 'a list
val of_list : 'a list -> 'a array
val iter : f:('a -> unit) -> 'a array -> unit
val iteri : f:(int -> 'a -> unit) -> 'a array -> unit
val map : f:('a -> 'b) -> 'a array -> 'b array
val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b array -> 'a
val fold_right : f:('b -> 'a -> 'a) -> 'b array -> init:'a -> 'a
val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit
val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
val for_all : f:('a -> bool) -> 'a array -> bool
val exists : f:('a -> bool) -> 'a array -> bool
val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val mem : 'a -> set:'a array -> bool
val memq : 'a -> set:'a array -> bool
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_seq : 'a array -> 'a Stdlib.Seq.t
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
\ No newline at end of file diff --git a/dev/containers/CCShimsEither_/index.html b/dev/containers/CCShimsEither_/index.html index f8d551f0..619873ed 100644 --- a/dev/containers/CCShimsEither_/index.html +++ b/dev/containers/CCShimsEither_/index.html @@ -1,2 +1,2 @@ -CCShimsEither_ (containers.CCShimsEither_)

Module CCShimsEither_

type ('a, 'b) t =
| Left of 'a
| Right of 'b
\ No newline at end of file +CCShimsEither_ (containers.CCShimsEither_)

Module CCShimsEither_

type ('a, 'b) t = ('a'b) Stdlib.Either.t =
| Left of 'a
| Right of 'b
\ No newline at end of file diff --git a/dev/containers/CCShimsList_/index.html b/dev/containers/CCShimsList_/index.html index b0ddb96f..20b20278 100644 --- a/dev/containers/CCShimsList_/index.html +++ b/dev/containers/CCShimsList_/index.html @@ -1,2 +1,2 @@ -CCShimsList_ (containers.CCShimsList_)

Module CCShimsList_

include Stdlib.List
type !'a t = 'a list =
| ([])
| (::) of 'a * 'a list
val length : 'a list -> int
val compare_lengths : 'a list -> 'b list -> int
val compare_length_with : 'a list -> int -> int
val cons : 'a -> 'a list -> 'a list
val hd : 'a list -> 'a
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val nth_opt : 'a list -> int -> 'a option
val rev : 'a list -> 'a list
val init : int -> (int -> 'a) -> 'a list
val append : 'a list -> 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
val flatten : 'a list list -> 'a list
val iter : ('a -> unit) -> 'a list -> unit
val iteri : (int -> 'a -> unit) -> 'a list -> unit
val map : ('a -> 'b) -> 'a list -> 'b list
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
val rev_map : ('a -> 'b) -> 'a list -> 'b list
val filter_map : ('a -> 'b option) -> 'a list -> 'b list
val concat_map : ('a -> 'b list) -> 'a list -> 'b list
val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a
val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit
val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a
val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
val for_all : ('a -> bool) -> 'a list -> bool
val exists : ('a -> bool) -> 'a list -> bool
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val mem : 'a -> 'a list -> bool
val memq : 'a -> 'a list -> bool
val find : ('a -> bool) -> 'a list -> 'a
val find_opt : ('a -> bool) -> 'a list -> 'a option
val find_map : ('a -> 'b option) -> 'a list -> 'b option
val filter : ('a -> bool) -> 'a list -> 'a list
val find_all : ('a -> bool) -> 'a list -> 'a list
val filteri : (int -> 'a -> bool) -> 'a list -> 'a list
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
val assoc : 'a -> ('a * 'b) list -> 'b
val assoc_opt : 'a -> ('a * 'b) list -> 'b option
val assq : 'a -> ('a * 'b) list -> 'b
val assq_opt : 'a -> ('a * 'b) list -> 'b option
val mem_assoc : 'a -> ('a * 'b) list -> bool
val mem_assq : 'a -> ('a * 'b) list -> bool
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val split : ('a * 'b) list -> 'a list * 'b list
val combine : 'a list -> 'b list -> ('a * 'b) list
val sort : ('a -> 'a -> int) -> 'a list -> 'a list
val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list
val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
val to_seq : 'a list -> 'a Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a list
\ No newline at end of file +CCShimsList_ (containers.CCShimsList_)

Module CCShimsList_

include Stdlib.List
type !'a t = 'a list =
| ([])
| (::) of 'a * 'a list
val length : 'a list -> int
val compare_lengths : 'a list -> 'b list -> int
val compare_length_with : 'a list -> int -> int
val cons : 'a -> 'a list -> 'a list
val hd : 'a list -> 'a
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val nth_opt : 'a list -> int -> 'a option
val rev : 'a list -> 'a list
val init : int -> (int -> 'a) -> 'a list
val append : 'a list -> 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
val flatten : 'a list list -> 'a list
val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool
val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int
val iter : ('a -> unit) -> 'a list -> unit
val iteri : (int -> 'a -> unit) -> 'a list -> unit
val map : ('a -> 'b) -> 'a list -> 'b list
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
val rev_map : ('a -> 'b) -> 'a list -> 'b list
val filter_map : ('a -> 'b option) -> 'a list -> 'b list
val concat_map : ('a -> 'b list) -> 'a list -> 'b list
val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a
val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit
val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a
val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
val for_all : ('a -> bool) -> 'a list -> bool
val exists : ('a -> bool) -> 'a list -> bool
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val mem : 'a -> 'a list -> bool
val memq : 'a -> 'a list -> bool
val find : ('a -> bool) -> 'a list -> 'a
val find_opt : ('a -> bool) -> 'a list -> 'a option
val find_map : ('a -> 'b option) -> 'a list -> 'b option
val filter : ('a -> bool) -> 'a list -> 'a list
val find_all : ('a -> bool) -> 'a list -> 'a list
val filteri : (int -> 'a -> bool) -> 'a list -> 'a list
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
val partition_map : ('a -> ('b'c) Stdlib.Either.t) -> 'a list -> 'b list * 'c list
val assoc : 'a -> ('a * 'b) list -> 'b
val assoc_opt : 'a -> ('a * 'b) list -> 'b option
val assq : 'a -> ('a * 'b) list -> 'b
val assq_opt : 'a -> ('a * 'b) list -> 'b option
val mem_assoc : 'a -> ('a * 'b) list -> bool
val mem_assq : 'a -> ('a * 'b) list -> bool
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val split : ('a * 'b) list -> 'a list * 'b list
val combine : 'a list -> 'b list -> ('a * 'b) list
val sort : ('a -> 'a -> int) -> 'a list -> 'a list
val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list
val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
val to_seq : 'a list -> 'a Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a list
\ No newline at end of file diff --git a/dev/containers/CCString/index.html b/dev/containers/CCString/index.html index 338c745f..d2fc86d8 100644 --- a/dev/containers/CCString/index.html +++ b/dev/containers/CCString/index.html @@ -1,2 +1,2 @@ -CCString (containers.CCString)

Module CCString

Basic String Utils

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

Fast internal iterator.

since
2.8
type 'a gen = unit -> 'a option

Documentation for the standard String module

include module type of sig ... end
val length : string -> int
val get : string -> int -> char
val set : bytes -> int -> char -> unit
val create : int -> bytes
val make : int -> char -> string
val init : int -> (int -> char) -> string
val copy : string -> string
val sub : string -> int -> int -> string
val fill : bytes -> int -> int -> char -> unit
val blit : string -> int -> bytes -> int -> int -> unit
val concat : string -> string list -> string
val iter : (char -> unit) -> string -> unit
val iteri : (int -> char -> unit) -> string -> unit
val map : (char -> char) -> string -> string
val mapi : (int -> char -> char) -> string -> string
val trim : string -> string
val escaped : string -> string
val index : string -> char -> int
val index_opt : string -> char -> int option
val rindex : string -> char -> int
val rindex_opt : string -> char -> int option
val index_from : string -> int -> char -> int
val index_from_opt : string -> int -> char -> int option
val rindex_from : string -> int -> char -> int
val rindex_from_opt : string -> int -> char -> int option
val contains : string -> char -> bool
val contains_from : string -> int -> char -> bool
val rcontains_from : string -> int -> char -> bool
val uppercase : string -> string
val lowercase : string -> string
val capitalize : string -> string
val uncapitalize : string -> string
val uppercase_ascii : string -> string
val lowercase_ascii : string -> string
val capitalize_ascii : string -> string
val uncapitalize_ascii : string -> string
type t = string
val compare : t -> t -> int
val equal : t -> t -> bool
val split_on_char : char -> string -> string list
val to_seq : t -> char Stdlib.Seq.t
val to_seqi : t -> (int * char) Stdlib.Seq.t
val of_seq : char Stdlib.Seq.t -> t
val unsafe_get : string -> int -> char
val unsafe_set : bytes -> int -> char -> unit
val unsafe_blit : string -> int -> bytes -> int -> int -> unit
val unsafe_fill : bytes -> int -> int -> char -> unit
val length : t -> int

length s returns the length (number of characters) of the given string s.

val blit : t -> int -> Stdlib.Bytes.t -> int -> int -> unit

blit src src_pos dst dst_pos len copies len characters from string src starting at character indice src_pos, to the Bytes sequence dst starting at character indice dst_pos. Like String.blit. Compatible with the -safe-string option.

raises Invalid_argument

if indices are not valid.

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

fold f init s folds on chars by increasing index. Computes f(… (f (f init s.[0]) s.[1]) …) s.[n-1].

since
0.7
val foldi : ('a -> int -> char -> 'a) -> 'a -> t -> 'a

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

since
3.3

Conversions

val to_gen : t -> char gen

to_gen s returns the gen of characters contained in the string s.

val to_iter : t -> char iter

to_iter s returns the iter of characters contained in the string s.

since
2.8
val to_seq : t -> char Stdlib.Seq.t

to_seq s returns the Seq.t of characters contained in the string s. Renamed from to std_seq since 3.0.

since
3.0
val to_list : t -> char list

to_list s returns the list of characters contained in the string s.

val pp_buf : Stdlib.Buffer.t -> t -> unit

pp_buf buf s prints s to the buffer buf. Renamed from pp since 2.0.

val pp : Stdlib.Format.formatter -> t -> unit

pp f s prints the string s within quotes to the formatter f. Renamed from print since 2.0.

val compare : string -> string -> int

compare s1 s2 compares the strings s1 and s2 and returns an integer that indicates their relative position in the sort order.

val is_empty : string -> bool

is_empty s returns true iff s is empty (i.e. its length is 0).

since
1.5
val hash : string -> int

hash s returns the hash value of s.

val rev : string -> string

rev s returns the reverse of s.

since
0.17
val pad : ?⁠side:[ `Left | `Right ] -> ?⁠c:char -> int -> string -> string

pad ~side ~c n s ensures that the string s is at least n bytes long, and pads it on the side with c if it's not the case.

parameter side

determines where padding occurs (default: `Left).

parameter c

the char used to pad (default: ' ').

since
0.17
val of_char : char -> string

of_char 'a' is "a".

since
0.19
val of_gen : char gen -> string

of_gen gen converts a gen of characters to a string.

val of_iter : char iter -> string

of_iter iter converts an iter of characters to a string.

since
2.8
val of_seq : char Stdlib.Seq.t -> string

of_seq seq converts a seq of characters to a string. Renamed from of_std_seq since 3.0.

since
3.0
val of_list : char list -> string

of_list lc converts a list of characters lc to a string.

val of_array : char array -> string

of_array ac converts an array of characters ac to a string.

val to_array : string -> char array

to_array s returns the array of characters contained in the string s.

val find : ?⁠start:int -> sub:string -> string -> int

find ~start ~sub s returns the starting index of the first occurrence of sub within s or -1.

parameter start

starting position in s.

val find_all : ?⁠start:int -> sub:string -> string -> int gen

find_all ~start ~sub s finds all occurrences of sub in s, even overlapping instances and returns them in a generator gen.

parameter start

starting position in s.

since
0.17
val find_all_l : ?⁠start:int -> sub:string -> string -> int list

find_all_l ~sub s finds all occurrences of sub in s and returns them in a list.

parameter start

starting position in s.

since
0.17
val mem : ?⁠start:int -> sub:string -> string -> bool

mem ~start ~sub s is true iff sub is a substring of s.

since
0.12
val rfind : sub:string -> string -> int

rfind ~sub s finds sub in string s from the right, returns its first index or -1. Should only be used with very small sub.

since
0.12
val replace : ?⁠which:[ `Left | `Right | `All ] -> sub:string -> by:string -> string -> string

replace ~which ~sub ~by s replaces some occurrences of sub by by in s.

parameter which

decides whether the occurrences to replace are:

  • `Left first occurrence from the left (beginning).
  • `Right first occurrence from the right (end).
  • `All all occurrences (default).
raises Invalid_argument

if sub = "".

since
0.14
val is_sub : sub:string -> int -> string -> int -> sub_len:int -> bool

is_sub ~sub ~sub_pos s ~pos ~sub_len returns true iff the substring of sub starting at position sub_pos and of length sub_len is a substring of s starting at position pos.

val repeat : string -> int -> string

repeat s n creates a string by repeating the string s n times.

val prefix : pre:string -> string -> bool

prefix ~pre s returns true iff pre is a prefix of s.

val suffix : suf:string -> string -> bool

suffix ~suf s returns true iff suf is a suffix of s.

since
0.7
val chop_prefix : pre:string -> string -> string option

chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.

since
0.17
val chop_suffix : suf:string -> string -> string option

chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.

since
0.17
val take : int -> string -> string

take n s keeps only the n first chars of s.

since
0.17
val drop : int -> string -> string

drop n s removes the n first chars of s.

since
0.17
val take_drop : int -> string -> string * string

take_drop n s is take n s, drop n s.

since
0.17
val lines : string -> string list

lines s returns a list of the lines of s (splits along '\n').

since
0.10
val lines_gen : string -> string gen

lines_gen s returns the gen of the lines of s (splits along '\n').

since
0.10
val lines_iter : string -> string iter

lines_iter s returns the iter of the lines of s (splits along '\n').

since
3.2
val lines_seq : string -> string Stdlib.Seq.t

lines_seq s returns the Seq.t of the lines of s (splits along '\n').

since
3.2
val concat_gen : sep:string -> string gen -> string

concat_gen ~sep gen concatenates all strings of gen, separated with sep.

since
0.10
val concat_seq : sep:string -> string Stdlib.Seq.t -> string

concat_seq ~sep seq concatenates all strings of seq, separated with sep.

since
3.2
val concat_iter : sep:string -> string iter -> string

concat_iter ~sep iter concatenates all strings of iter, separated with sep.

since
3.2
val unlines : string list -> string

unlines ls concatenates all strings of ls, separated with '\n'.

since
0.10
val unlines_gen : string gen -> string

unlines_gen gen concatenates all strings of gen, separated with '\n'.

since
0.10
val unlines_iter : string iter -> string

unlines_iter iter concatenates all strings of iter, separated with '\n'.

since
3.2
val unlines_seq : string Stdlib.Seq.t -> string

unlines_seq seq concatenates all strings of seq, separated with '\n'.

since
3.2
val set : string -> int -> char -> string

set s i c creates a new string which is a copy of s, except for index i, which becomes c.

raises Invalid_argument

if i is an invalid index.

since
0.12
val iter : (char -> unit) -> string -> unit

iter f s applies function f on each character of s. Alias to String.iter.

since
0.12
val filter_map : (char -> char option) -> string -> string

filter_map f s calls (f a0) (f a1) … (f an) where a0 … an are the characters of s. It returns the string of characters ci such as f ai = Some ci (when f returns None, the corresponding element of s is discarded).

since
0.17
val filter : (char -> bool) -> string -> string

filter f s discards characters of s not satisfying f.

since
0.17
val flat_map : ?⁠sep:string -> (char -> string) -> string -> string

flat_map ~sep f s maps each chars of s to a string, then concatenates them all.

parameter sep

optional separator between each generated string.

since
0.12
val for_all : (char -> bool) -> string -> bool

for_all f s is true iff all characters of s satisfy the predicate f.

since
0.12
val exists : (char -> bool) -> string -> bool

exists f s is true iff some character of s satisfy the predicate f.

since
0.12
val drop_while : (char -> bool) -> t -> t

drop_while f s discards any characters of s starting from the left, up to the first character c not satisfying f c.

since
2.2
val rdrop_while : (char -> bool) -> t -> t

rdrop_while f s discards any characters of s starting from the right, up to the first character c not satisfying f c.

since
2.2
val ltrim : t -> t

ltrim s trims space on the left (see String.trim for more details).

since
1.2
val rtrim : t -> t

rtrim s trims space on the right (see String.trim for more details).

since
1.2

Operations on 2 strings

val map2 : (char -> char -> char) -> string -> string -> string

map2 f s1 s2 maps pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val iter2 : (char -> char -> unit) -> string -> string -> unit

iter2 f s1 s2 iterates on pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val iteri2 : (int -> char -> char -> unit) -> string -> string -> unit

iteri2 f s1 s2 iterates on pairs of chars with their index.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val fold2 : ('a -> char -> char -> 'a) -> 'a -> string -> string -> 'a

fold2 f init s1 s2 folds on pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val for_all2 : (char -> char -> bool) -> string -> string -> bool

for_all2 f s1 s2 returns true iff all pairs of chars satisfy the predicate f.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val exists2 : (char -> char -> bool) -> string -> string -> bool

exists2 f s1 s2 returns true iff a pair of chars satisfy the predicate f.

raises Invalid_argument

if the strings have not the same length.

since
0.12

Ascii functions

Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.

val equal_caseless : string -> string -> bool

equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.

since
1.2

Finding

A relatively efficient algorithm for finding sub-strings.

since
1.0
module Find : sig ... end

Splitting

module Split : sig ... end
val split_on_char : char -> string -> string list

split_on_char by s splits the string s along the given char by.

since
1.2
val split : by:string -> string -> string list

split ~by s splits the string s along the given string by. Alias to Split.list_cpy.

since
1.2

Utils

val compare_versions : string -> string -> int

compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.

since
0.13
val compare_natural : string -> string -> int

compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order

since
1.3
val edit_distance : ?⁠cutoff:int -> string -> string -> int

edit_distance ~cutoff s1 s2 is the edition distance between the two strings s1 and s2. This satisfies the classical distance axioms: it is always positive, symmetric, and satisfies the formula distance s1 s2 + distance s2 s3 >= distance s1 s3.

parameter cutoff

if provided, it's a cap on both the number of iterations, and on the result. (since 3.0). This is useful if you just want to check whether the edit distance is less or equal than 2 (use cutoff of 3).

Infix operators

since
3.0
module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
since
3.0
val (<>) : t -> t -> bool
since
3.0
val (<) : t -> t -> bool
since
3.0
val (<=) : t -> t -> bool
since
3.0
val (>=) : t -> t -> bool
since
3.0
val (>) : t -> t -> bool
since
3.0
\ No newline at end of file +CCString (containers.CCString)

Module CCString

Basic String Utils

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

Fast internal iterator.

since
2.8
type 'a gen = unit -> 'a option

Documentation for the standard String module

include module type of sig ... end
type t = string
val make : int -> char -> string
val init : int -> (int -> char) -> string
val length : string -> int
val get : string -> int -> char
val concat : string -> string list -> string
val equal : t -> t -> bool
val compare : t -> t -> int
val contains_from : string -> int -> char -> bool
val rcontains_from : string -> int -> char -> bool
val contains : string -> char -> bool
val sub : string -> int -> int -> string
val split_on_char : char -> string -> string list
val map : (char -> char) -> string -> string
val mapi : (int -> char -> char) -> string -> string
val trim : string -> string
val escaped : string -> string
val uppercase_ascii : string -> string
val lowercase_ascii : string -> string
val capitalize_ascii : string -> string
val uncapitalize_ascii : string -> string
val iter : (char -> unit) -> string -> unit
val iteri : (int -> char -> unit) -> string -> unit
val index_from : string -> int -> char -> int
val index_from_opt : string -> int -> char -> int option
val rindex_from : string -> int -> char -> int
val rindex_from_opt : string -> int -> char -> int option
val index : string -> char -> int
val index_opt : string -> char -> int option
val rindex : string -> char -> int
val rindex_opt : string -> char -> int option
val to_seq : t -> char Stdlib.Seq.t
val to_seqi : t -> (int * char) Stdlib.Seq.t
val of_seq : char Stdlib.Seq.t -> t
val create : int -> bytes
val set : bytes -> int -> char -> unit
val blit : string -> int -> bytes -> int -> int -> unit
val copy : string -> string
val fill : bytes -> int -> int -> char -> unit
val uppercase : string -> string
val lowercase : string -> string
val capitalize : string -> string
val uncapitalize : string -> string
val unsafe_get : string -> int -> char
val unsafe_set : bytes -> int -> char -> unit
val unsafe_blit : string -> int -> bytes -> int -> int -> unit
val unsafe_fill : bytes -> int -> int -> char -> unit
val length : t -> int

length s returns the length (number of characters) of the given string s.

val blit : t -> int -> Stdlib.Bytes.t -> int -> int -> unit

blit src src_pos dst dst_pos len copies len characters from string src starting at character indice src_pos, to the Bytes sequence dst starting at character indice dst_pos. Like String.blit. Compatible with the -safe-string option.

raises Invalid_argument

if indices are not valid.

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

fold f init s folds on chars by increasing index. Computes f(… (f (f init s.[0]) s.[1]) …) s.[n-1].

since
0.7
val foldi : ('a -> int -> char -> 'a) -> 'a -> t -> 'a

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

since
3.3

Conversions

val to_gen : t -> char gen

to_gen s returns the gen of characters contained in the string s.

val to_iter : t -> char iter

to_iter s returns the iter of characters contained in the string s.

since
2.8
val to_seq : t -> char Stdlib.Seq.t

to_seq s returns the Seq.t of characters contained in the string s. Renamed from to std_seq since 3.0.

since
3.0
val to_list : t -> char list

to_list s returns the list of characters contained in the string s.

val pp_buf : Stdlib.Buffer.t -> t -> unit

pp_buf buf s prints s to the buffer buf. Renamed from pp since 2.0.

val pp : Stdlib.Format.formatter -> t -> unit

pp f s prints the string s within quotes to the formatter f. Renamed from print since 2.0.

val compare : string -> string -> int

compare s1 s2 compares the strings s1 and s2 and returns an integer that indicates their relative position in the sort order.

val is_empty : string -> bool

is_empty s returns true iff s is empty (i.e. its length is 0).

since
1.5
val hash : string -> int

hash s returns the hash value of s.

val rev : string -> string

rev s returns the reverse of s.

since
0.17
val pad : ?⁠side:[ `Left | `Right ] -> ?⁠c:char -> int -> string -> string

pad ~side ~c n s ensures that the string s is at least n bytes long, and pads it on the side with c if it's not the case.

parameter side

determines where padding occurs (default: `Left).

parameter c

the char used to pad (default: ' ').

since
0.17
val of_char : char -> string

of_char 'a' is "a".

since
0.19
val of_gen : char gen -> string

of_gen gen converts a gen of characters to a string.

val of_iter : char iter -> string

of_iter iter converts an iter of characters to a string.

since
2.8
val of_seq : char Stdlib.Seq.t -> string

of_seq seq converts a seq of characters to a string. Renamed from of_std_seq since 3.0.

since
3.0
val of_list : char list -> string

of_list lc converts a list of characters lc to a string.

val of_array : char array -> string

of_array ac converts an array of characters ac to a string.

val to_array : string -> char array

to_array s returns the array of characters contained in the string s.

val find : ?⁠start:int -> sub:string -> string -> int

find ~start ~sub s returns the starting index of the first occurrence of sub within s or -1.

parameter start

starting position in s.

val find_all : ?⁠start:int -> sub:string -> string -> int gen

find_all ~start ~sub s finds all occurrences of sub in s, even overlapping instances and returns them in a generator gen.

parameter start

starting position in s.

since
0.17
val find_all_l : ?⁠start:int -> sub:string -> string -> int list

find_all_l ~sub s finds all occurrences of sub in s and returns them in a list.

parameter start

starting position in s.

since
0.17
val mem : ?⁠start:int -> sub:string -> string -> bool

mem ~start ~sub s is true iff sub is a substring of s.

since
0.12
val rfind : sub:string -> string -> int

rfind ~sub s finds sub in string s from the right, returns its first index or -1. Should only be used with very small sub.

since
0.12
val replace : ?⁠which:[ `Left | `Right | `All ] -> sub:string -> by:string -> string -> string

replace ~which ~sub ~by s replaces some occurrences of sub by by in s.

parameter which

decides whether the occurrences to replace are:

  • `Left first occurrence from the left (beginning).
  • `Right first occurrence from the right (end).
  • `All all occurrences (default).
raises Invalid_argument

if sub = "".

since
0.14
val is_sub : sub:string -> int -> string -> int -> sub_len:int -> bool

is_sub ~sub ~sub_pos s ~pos ~sub_len returns true iff the substring of sub starting at position sub_pos and of length sub_len is a substring of s starting at position pos.

val repeat : string -> int -> string

repeat s n creates a string by repeating the string s n times.

val prefix : pre:string -> string -> bool

prefix ~pre s returns true iff pre is a prefix of s.

val suffix : suf:string -> string -> bool

suffix ~suf s returns true iff suf is a suffix of s.

since
0.7
val chop_prefix : pre:string -> string -> string option

chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.

since
0.17
val chop_suffix : suf:string -> string -> string option

chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.

since
0.17
val take : int -> string -> string

take n s keeps only the n first chars of s.

since
0.17
val drop : int -> string -> string

drop n s removes the n first chars of s.

since
0.17
val take_drop : int -> string -> string * string

take_drop n s is take n s, drop n s.

since
0.17
val lines : string -> string list

lines s returns a list of the lines of s (splits along '\n').

since
0.10
val lines_gen : string -> string gen

lines_gen s returns the gen of the lines of s (splits along '\n').

since
0.10
val lines_iter : string -> string iter

lines_iter s returns the iter of the lines of s (splits along '\n').

since
3.2
val lines_seq : string -> string Stdlib.Seq.t

lines_seq s returns the Seq.t of the lines of s (splits along '\n').

since
3.2
val concat_gen : sep:string -> string gen -> string

concat_gen ~sep gen concatenates all strings of gen, separated with sep.

since
0.10
val concat_seq : sep:string -> string Stdlib.Seq.t -> string

concat_seq ~sep seq concatenates all strings of seq, separated with sep.

since
3.2
val concat_iter : sep:string -> string iter -> string

concat_iter ~sep iter concatenates all strings of iter, separated with sep.

since
3.2
val unlines : string list -> string

unlines ls concatenates all strings of ls, separated with '\n'.

since
0.10
val unlines_gen : string gen -> string

unlines_gen gen concatenates all strings of gen, separated with '\n'.

since
0.10
val unlines_iter : string iter -> string

unlines_iter iter concatenates all strings of iter, separated with '\n'.

since
3.2
val unlines_seq : string Stdlib.Seq.t -> string

unlines_seq seq concatenates all strings of seq, separated with '\n'.

since
3.2
val set : string -> int -> char -> string

set s i c creates a new string which is a copy of s, except for index i, which becomes c.

raises Invalid_argument

if i is an invalid index.

since
0.12
val iter : (char -> unit) -> string -> unit

iter f s applies function f on each character of s. Alias to String.iter.

since
0.12
val filter_map : (char -> char option) -> string -> string

filter_map f s calls (f a0) (f a1) … (f an) where a0 … an are the characters of s. It returns the string of characters ci such as f ai = Some ci (when f returns None, the corresponding element of s is discarded).

since
0.17
val filter : (char -> bool) -> string -> string

filter f s discards characters of s not satisfying f.

since
0.17
val flat_map : ?⁠sep:string -> (char -> string) -> string -> string

flat_map ~sep f s maps each chars of s to a string, then concatenates them all.

parameter sep

optional separator between each generated string.

since
0.12
val for_all : (char -> bool) -> string -> bool

for_all f s is true iff all characters of s satisfy the predicate f.

since
0.12
val exists : (char -> bool) -> string -> bool

exists f s is true iff some character of s satisfy the predicate f.

since
0.12
val drop_while : (char -> bool) -> t -> t

drop_while f s discards any characters of s starting from the left, up to the first character c not satisfying f c.

since
2.2
val rdrop_while : (char -> bool) -> t -> t

rdrop_while f s discards any characters of s starting from the right, up to the first character c not satisfying f c.

since
2.2
val ltrim : t -> t

ltrim s trims space on the left (see String.trim for more details).

since
1.2
val rtrim : t -> t

rtrim s trims space on the right (see String.trim for more details).

since
1.2

Operations on 2 strings

val map2 : (char -> char -> char) -> string -> string -> string

map2 f s1 s2 maps pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val iter2 : (char -> char -> unit) -> string -> string -> unit

iter2 f s1 s2 iterates on pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val iteri2 : (int -> char -> char -> unit) -> string -> string -> unit

iteri2 f s1 s2 iterates on pairs of chars with their index.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val fold2 : ('a -> char -> char -> 'a) -> 'a -> string -> string -> 'a

fold2 f init s1 s2 folds on pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val for_all2 : (char -> char -> bool) -> string -> string -> bool

for_all2 f s1 s2 returns true iff all pairs of chars satisfy the predicate f.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val exists2 : (char -> char -> bool) -> string -> string -> bool

exists2 f s1 s2 returns true iff a pair of chars satisfy the predicate f.

raises Invalid_argument

if the strings have not the same length.

since
0.12

Ascii functions

Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.

val equal_caseless : string -> string -> bool

equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.

since
1.2

Finding

A relatively efficient algorithm for finding sub-strings.

since
1.0
module Find : sig ... end

Splitting

module Split : sig ... end
val split_on_char : char -> string -> string list

split_on_char by s splits the string s along the given char by.

since
1.2
val split : by:string -> string -> string list

split ~by s splits the string s along the given string by. Alias to Split.list_cpy.

since
1.2

Utils

val compare_versions : string -> string -> int

compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.

since
0.13
val compare_natural : string -> string -> int

compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order

since
1.3
val edit_distance : ?⁠cutoff:int -> string -> string -> int

edit_distance ~cutoff s1 s2 is the edition distance between the two strings s1 and s2. This satisfies the classical distance axioms: it is always positive, symmetric, and satisfies the formula distance s1 s2 + distance s2 s3 >= distance s1 s3.

parameter cutoff

if provided, it's a cap on both the number of iterations, and on the result. (since 3.0). This is useful if you just want to check whether the edit distance is less or equal than 2 (use cutoff of 3).

Infix operators

since
3.0
module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
since
3.0
val (<>) : t -> t -> bool
since
3.0
val (<) : t -> t -> bool
since
3.0
val (<=) : t -> t -> bool
since
3.0
val (>=) : t -> t -> bool
since
3.0
val (>) : t -> t -> bool
since
3.0
\ No newline at end of file diff --git a/dev/containers/CCStringLabels/index.html b/dev/containers/CCStringLabels/index.html index 08badb57..f662e67f 100644 --- a/dev/containers/CCStringLabels/index.html +++ b/dev/containers/CCStringLabels/index.html @@ -1,2 +1,2 @@ -CCStringLabels (containers.CCStringLabels)

Module CCStringLabels

Basic String Utils

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

Fast internal iterator.

since
2.8
type 'a gen = unit -> 'a option

Documentation for the standard StringLabels module

include module type of sig ... end
val length : string -> int
val get : string -> int -> char
val set : bytes -> int -> char -> unit
val create : int -> bytes
val make : int -> char -> string
val init : int -> f:(int -> char) -> string
val copy : string -> string
val sub : string -> pos:int -> len:int -> string
val fill : bytes -> pos:int -> len:int -> char -> unit
val blit : src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit
val concat : sep:string -> string list -> string
val iter : f:(char -> unit) -> string -> unit
val iteri : f:(int -> char -> unit) -> string -> unit
val map : f:(char -> char) -> string -> string
val mapi : f:(int -> char -> char) -> string -> string
val trim : string -> string
val escaped : string -> string
val index : string -> char -> int
val index_opt : string -> char -> int option
val rindex : string -> char -> int
val rindex_opt : string -> char -> int option
val index_from : string -> int -> char -> int
val index_from_opt : string -> int -> char -> int option
val rindex_from : string -> int -> char -> int
val rindex_from_opt : string -> int -> char -> int option
val contains : string -> char -> bool
val contains_from : string -> int -> char -> bool
val rcontains_from : string -> int -> char -> bool
val uppercase : string -> string
val lowercase : string -> string
val capitalize : string -> string
val uncapitalize : string -> string
val uppercase_ascii : string -> string
val lowercase_ascii : string -> string
val capitalize_ascii : string -> string
val uncapitalize_ascii : string -> string
type t = string
val compare : t -> t -> int
val equal : t -> t -> bool
val split_on_char : sep:char -> string -> string list
val to_seq : t -> char Stdlib.Seq.t
val to_seqi : t -> (int * char) Stdlib.Seq.t
val of_seq : char Stdlib.Seq.t -> t
val unsafe_get : string -> int -> char
val unsafe_set : bytes -> int -> char -> unit
val unsafe_blit : src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit
val unsafe_fill : bytes -> pos:int -> len:int -> char -> unit
val length : t -> int

length s returns the length (number of characters) of the given string s.

val blit : src:t -> src_pos:int -> dst:Stdlib.Bytes.t -> dst_pos:int -> len:int -> unit

blit ~src ~src_pos ~dst ~dst_pos ~len copies len characters from string src starting at character indice src_pos, to the Bytes sequence dst starting at character indice dst_pos. Like String.blit. Compatible with the -safe-string option.

raises Invalid_argument

if indices are not valid.

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

fold ~f ~init s folds on chars by increasing index. Computes f(… (f (f init s.[0]) s.[1]) …) s.[n-1].

since
0.7
val foldi : f:('a -> int -> char -> 'a) -> 'a -> t -> 'a

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

since
3.3

Conversions

val to_gen : t -> char gen

to_gen s returns the gen of characters contained in the string s.

val to_iter : t -> char iter

to_iter s returns the iter of characters contained in the string s.

since
2.8
val to_seq : t -> char Stdlib.Seq.t

to_seq s returns the Seq.t of characters contained in the string s. Renamed from to std_seq since 3.0.

since
3.0
val to_list : t -> char list

to_list s returns the list of characters contained in the string s.

val pp_buf : Stdlib.Buffer.t -> t -> unit

pp_buf buf s prints s to the buffer buf. Renamed from pp since 2.0.

val pp : Stdlib.Format.formatter -> t -> unit

pp f s prints the string s within quotes to the formatter f. Renamed from print since 2.0.

Strings

val equal : string -> string -> bool

equal s1 s2 returns true iff the strings s1 and s2 are equal.

val compare : string -> string -> int

compare s1 s2 compares the strings s1 and s2 and returns an integer that indicates their relative position in the sort order.

val is_empty : string -> bool

is_empty s returns true iff s is empty (i.e. its length is 0).

since
1.5
val hash : string -> int

hash s returns the hash value of s.

val rev : string -> string

rev s returns the reverse of s.

since
0.17
val pad : ?⁠side:[ `Left | `Right ] -> ?⁠c:char -> int -> string -> string

pad ?side ?c n s ensures that the string s is at least n bytes long, and pads it on the side with c if it's not the case.

parameter side

determines where padding occurs (default: `Left).

parameter c

the char used to pad (default: ' ').

since
0.17
val of_char : char -> string

of_char 'a' is "a".

since
0.19
val of_gen : char gen -> string

of_gen gen converts a gen of characters to a string.

val of_iter : char iter -> string

of_iter iter converts an iter of characters to a string.

since
2.8
val of_seq : char Stdlib.Seq.t -> string

of_seq seq converts a seq of characters to a string. Renamed from of_std_seq since 3.0.

since
3.0
val of_list : char list -> string

of_list lc converts a list of characters lc to a string.

val of_array : char array -> string

of_array ac converts an array of characters ac to a string.

val to_array : string -> char array

to_array s returns the array of characters contained in the string s.

val find : ?⁠start:int -> sub:string -> string -> int

find ?start ~sub s returns the starting index of the first occurrence of sub within s or -1.

parameter start

starting position in s.

val find_all : ?⁠start:int -> sub:string -> string -> int gen

find_all ?start ~sub s finds all occurrences of sub in s, even overlapping instances and returns them in a generator gen.

parameter start

starting position in s.

since
0.17
val find_all_l : ?⁠start:int -> sub:string -> string -> int list

find_all_l ?start ~sub s finds all occurrences of sub in s and returns them in a list.

parameter start

starting position in s.

since
0.17
val mem : ?⁠start:int -> sub:string -> string -> bool

mem ?start ~sub s is true iff sub is a substring of s.

since
0.12
val rfind : sub:string -> string -> int

rfind ~sub s finds sub in string s from the right, returns its first index or -1. Should only be used with very small sub.

since
0.12
val replace : ?⁠which:[ `Left | `Right | `All ] -> sub:string -> by:string -> string -> string

replace ?which ~sub ~by s replaces some occurrences of sub by by in s.

parameter which

decides whether the occurrences to replace are:

  • `Left first occurrence from the left (beginning).
  • `Right first occurrence from the right (end).
  • `All all occurrences (default).
raises Invalid_argument

if sub = "".

since
0.14
val is_sub : sub:string -> sub_pos:int -> string -> pos:int -> sub_len:int -> bool

is_sub ~sub ~sub_pos s ~pos ~sub_len returns true iff the substring of sub starting at position sub_pos and of length sub_len is a substring of s starting at position pos.

val repeat : string -> int -> string

repeat s n creates a string by repeating the string s n times.

val prefix : pre:string -> string -> bool

prefix ~pre s returns true iff pre is a prefix of s.

val suffix : suf:string -> string -> bool

suffix ~suf s returns true iff suf is a suffix of s.

since
0.7
val chop_prefix : pre:string -> string -> string option

chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.

since
0.17
val chop_suffix : suf:string -> string -> string option

chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.

since
0.17
val take : int -> string -> string

take n s keeps only the n first chars of s.

since
0.17
val drop : int -> string -> string

drop n s removes the n first chars of s.

since
0.17
val take_drop : int -> string -> string * string

take_drop n s is take n s, drop n s.

since
0.17
val lines : string -> string list

lines s returns a list of the lines of s (splits along '\n').

since
0.10
val lines_gen : string -> string gen

lines_gen s returns a generator gen of the lines of s (splits along '\n').

since
0.10
val lines_iter : string -> string iter

lines_iter s returns the iter of the lines of s (splits along '\n').

since
3.2
val lines_seq : string -> string Stdlib.Seq.t

lines_seq s returns the Seq.t of the lines of s (splits along '\n').

since
3.2
val concat_iter : sep:string -> string iter -> string

concat_iter ~sep iter concatenates all strings of iter, separated with sep.

since
3.2
val concat_gen : sep:string -> string gen -> string

concat_gen ~sep gen concatenates all strings of gen, separated with sep.

since
0.10
val concat_seq : sep:string -> string Stdlib.Seq.t -> string

concat_seq ~sep seq concatenates all strings of seq, separated with sep.

since
3.2
val unlines : string list -> string

unlines ls concatenates all strings of ls, separated with '\n'.

since
0.10
val unlines_gen : string gen -> string

unlines_gen gen concatenates all strings of gen, separated with '\n'.

since
0.10
val unlines_iter : string iter -> string

unlines_iter iter concatenates all strings of iter, separated with '\n'.

since
3.2
val unlines_seq : string Stdlib.Seq.t -> string

unlines_seq seq concatenates all strings of seq, separated with '\n'.

since
3.2
val set : string -> int -> char -> string

set s i c creates a new string which is a copy of s, except for index i, which becomes c.

raises Invalid_argument

if i is an invalid index.

since
0.12
val iter : f:(char -> unit) -> string -> unit

iter ~f s applies function f on each character of s. Alias to String.iter.

since
0.12
val filter_map : f:(char -> char option) -> string -> string

filter_map ~f s calls (f a0) (f a1) … (f an) where a0 … an are the characters of s. It returns the string of characters ci such as f ai = Some ci (when f returns None, the corresponding element of s is discarded).

since
0.17
val filter : f:(char -> bool) -> string -> string

filter ~f s discards characters of s not satisfying f.

since
0.17
val flat_map : ?⁠sep:string -> f:(char -> string) -> string -> string

flat_map ?sep ~f s maps each chars of s to a string, then concatenates them all.

parameter sep

optional separator between each generated string.

since
0.12
val for_all : f:(char -> bool) -> string -> bool

for_all ~f s is true iff all characters of s satisfy the predicate f.

since
0.12
val exists : f:(char -> bool) -> string -> bool

exists ~f s is true iff some character of s satisfy the predicate f.

since
0.12
val drop_while : f:(char -> bool) -> t -> t

drop_while ~f s discards any characters of s starting from the left, up to the first character c not satisfying f c.

since
2.2
val rdrop_while : f:(char -> bool) -> t -> t

rdrop_while ~f s discards any characters of s starting from the right, up to the first character c not satisfying f c.

since
2.2
val ltrim : t -> t

ltrim s trims space on the left (see String.trim for more details).

since
1.2
val rtrim : t -> t

rtrim s trims space on the right (see String.trim for more details).

since
1.2

Operations on 2 strings

val map2 : f:(char -> char -> char) -> string -> string -> string

map2 ~f s1 s2 maps pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val iter2 : f:(char -> char -> unit) -> string -> string -> unit

iter2 ~f s1 s2 iterates on pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val iteri2 : f:(int -> char -> char -> unit) -> string -> string -> unit

iteri2 ~f s1 s2 iterates on pairs of chars with their index.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val fold2 : f:('a -> char -> char -> 'a) -> init:'a -> string -> string -> 'a

fold2 ~f ~init s1 s2 folds on pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val for_all2 : f:(char -> char -> bool) -> string -> string -> bool

for_all2 ~f s1 s2 returns true iff all pairs of chars satisfy the predicate f.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val exists2 : f:(char -> char -> bool) -> string -> string -> bool

exists2 ~f s1 s2 returns true iff a pair of chars satisfy the predicate f.

raises Invalid_argument

if the strings have not the same length.

since
0.12

Ascii functions

Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.

val capitalize_ascii : string -> string

capitalize_ascii s returns a copy of s with the first character set to uppercase using the US-ASCII character set. See String.

since
0.18
val uncapitalize_ascii : string -> string

uncapitalize_ascii s returns a copy of s with the first character set to lowercase using the US-ASCII character set. See String.

since
0.18
val uppercase_ascii : string -> string

uppercase_ascii s returns a copy of s with all lowercase letters translated to uppercase using the US-ASCII character set. See String.

since
0.18
val lowercase_ascii : string -> string

lowercase_ascii s returns a copy of s with all uppercase letters translated to lowercase using the US-ASCII character set. See String.

since
0.18
val equal_caseless : string -> string -> bool

equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.

since
1.2

Finding

A relatively efficient algorithm for finding sub-strings.

since
1.0
module Find : sig ... end

Splitting

module Split : sig ... end
val split_on_char : by:char -> string -> string list

split_on_char ~by s splits the string s along the given char by.

since
1.2
val split : by:string -> string -> string list

split ~by s splits the string s along the given string by. Alias to Split.list_cpy.

since
1.2

Utils

val compare_versions : string -> string -> int

compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.

since
0.13
val compare_natural : string -> string -> int

compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order

since
1.3
val edit_distance : ?⁠cutoff:int -> string -> string -> int

edit_distance ?cutoff s1 s2 is the edition distance between the two strings s1 and s2. This satisfies the classical distance axioms: it is always positive, symmetric, and satisfies the formula distance s1 s2 + distance s2 s3 >= distance s1 s3.

parameter cutoff

if provided, it's a cap on both the number of iterations, and on the result. (since 3.0). This is useful if you just want to check whether the edit distance is less or equal than 2 (use cutoff of 3).

Infix operators

since
3.0
module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
since
3.0
val (<>) : t -> t -> bool
since
3.0
val (<) : t -> t -> bool
since
3.0
val (<=) : t -> t -> bool
since
3.0
val (>=) : t -> t -> bool
since
3.0
val (>) : t -> t -> bool
since
3.0
\ No newline at end of file +CCStringLabels (containers.CCStringLabels)

Module CCStringLabels

Basic String Utils

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

Fast internal iterator.

since
2.8
type 'a gen = unit -> 'a option

Documentation for the standard StringLabels module

include module type of sig ... end
type t = string
val make : int -> char -> string
val init : int -> f:(int -> char) -> string
val length : string -> int
val get : string -> int -> char
val concat : sep:string -> string list -> string
val equal : t -> t -> bool
val compare : t -> t -> int
val contains_from : string -> int -> char -> bool
val rcontains_from : string -> int -> char -> bool
val contains : string -> char -> bool
val sub : string -> pos:int -> len:int -> string
val split_on_char : sep:char -> string -> string list
val map : f:(char -> char) -> string -> string
val mapi : f:(int -> char -> char) -> string -> string
val trim : string -> string
val escaped : string -> string
val uppercase_ascii : string -> string
val lowercase_ascii : string -> string
val capitalize_ascii : string -> string
val uncapitalize_ascii : string -> string
val iter : f:(char -> unit) -> string -> unit
val iteri : f:(int -> char -> unit) -> string -> unit
val index_from : string -> int -> char -> int
val index_from_opt : string -> int -> char -> int option
val rindex_from : string -> int -> char -> int
val rindex_from_opt : string -> int -> char -> int option
val index : string -> char -> int
val index_opt : string -> char -> int option
val rindex : string -> char -> int
val rindex_opt : string -> char -> int option
val to_seq : t -> char Stdlib.Seq.t
val to_seqi : t -> (int * char) Stdlib.Seq.t
val of_seq : char Stdlib.Seq.t -> t
val create : int -> bytes
val set : bytes -> int -> char -> unit
val blit : src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit
val copy : string -> string
val fill : bytes -> pos:int -> len:int -> char -> unit
val uppercase : string -> string
val lowercase : string -> string
val capitalize : string -> string
val uncapitalize : string -> string
val unsafe_get : string -> int -> char
val unsafe_set : bytes -> int -> char -> unit
val unsafe_blit : src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit
val unsafe_fill : bytes -> pos:int -> len:int -> char -> unit
val length : t -> int

length s returns the length (number of characters) of the given string s.

val blit : src:t -> src_pos:int -> dst:Stdlib.Bytes.t -> dst_pos:int -> len:int -> unit

blit ~src ~src_pos ~dst ~dst_pos ~len copies len characters from string src starting at character indice src_pos, to the Bytes sequence dst starting at character indice dst_pos. Like String.blit. Compatible with the -safe-string option.

raises Invalid_argument

if indices are not valid.

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

fold ~f ~init s folds on chars by increasing index. Computes f(… (f (f init s.[0]) s.[1]) …) s.[n-1].

since
0.7
val foldi : f:('a -> int -> char -> 'a) -> 'a -> t -> 'a

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

since
3.3

Conversions

val to_gen : t -> char gen

to_gen s returns the gen of characters contained in the string s.

val to_iter : t -> char iter

to_iter s returns the iter of characters contained in the string s.

since
2.8
val to_seq : t -> char Stdlib.Seq.t

to_seq s returns the Seq.t of characters contained in the string s. Renamed from to std_seq since 3.0.

since
3.0
val to_list : t -> char list

to_list s returns the list of characters contained in the string s.

val pp_buf : Stdlib.Buffer.t -> t -> unit

pp_buf buf s prints s to the buffer buf. Renamed from pp since 2.0.

val pp : Stdlib.Format.formatter -> t -> unit

pp f s prints the string s within quotes to the formatter f. Renamed from print since 2.0.

Strings

val equal : string -> string -> bool

equal s1 s2 returns true iff the strings s1 and s2 are equal.

val compare : string -> string -> int

compare s1 s2 compares the strings s1 and s2 and returns an integer that indicates their relative position in the sort order.

val is_empty : string -> bool

is_empty s returns true iff s is empty (i.e. its length is 0).

since
1.5
val hash : string -> int

hash s returns the hash value of s.

val rev : string -> string

rev s returns the reverse of s.

since
0.17
val pad : ?⁠side:[ `Left | `Right ] -> ?⁠c:char -> int -> string -> string

pad ?side ?c n s ensures that the string s is at least n bytes long, and pads it on the side with c if it's not the case.

parameter side

determines where padding occurs (default: `Left).

parameter c

the char used to pad (default: ' ').

since
0.17
val of_char : char -> string

of_char 'a' is "a".

since
0.19
val of_gen : char gen -> string

of_gen gen converts a gen of characters to a string.

val of_iter : char iter -> string

of_iter iter converts an iter of characters to a string.

since
2.8
val of_seq : char Stdlib.Seq.t -> string

of_seq seq converts a seq of characters to a string. Renamed from of_std_seq since 3.0.

since
3.0
val of_list : char list -> string

of_list lc converts a list of characters lc to a string.

val of_array : char array -> string

of_array ac converts an array of characters ac to a string.

val to_array : string -> char array

to_array s returns the array of characters contained in the string s.

val find : ?⁠start:int -> sub:string -> string -> int

find ?start ~sub s returns the starting index of the first occurrence of sub within s or -1.

parameter start

starting position in s.

val find_all : ?⁠start:int -> sub:string -> string -> int gen

find_all ?start ~sub s finds all occurrences of sub in s, even overlapping instances and returns them in a generator gen.

parameter start

starting position in s.

since
0.17
val find_all_l : ?⁠start:int -> sub:string -> string -> int list

find_all_l ?start ~sub s finds all occurrences of sub in s and returns them in a list.

parameter start

starting position in s.

since
0.17
val mem : ?⁠start:int -> sub:string -> string -> bool

mem ?start ~sub s is true iff sub is a substring of s.

since
0.12
val rfind : sub:string -> string -> int

rfind ~sub s finds sub in string s from the right, returns its first index or -1. Should only be used with very small sub.

since
0.12
val replace : ?⁠which:[ `Left | `Right | `All ] -> sub:string -> by:string -> string -> string

replace ?which ~sub ~by s replaces some occurrences of sub by by in s.

parameter which

decides whether the occurrences to replace are:

  • `Left first occurrence from the left (beginning).
  • `Right first occurrence from the right (end).
  • `All all occurrences (default).
raises Invalid_argument

if sub = "".

since
0.14
val is_sub : sub:string -> sub_pos:int -> string -> pos:int -> sub_len:int -> bool

is_sub ~sub ~sub_pos s ~pos ~sub_len returns true iff the substring of sub starting at position sub_pos and of length sub_len is a substring of s starting at position pos.

val repeat : string -> int -> string

repeat s n creates a string by repeating the string s n times.

val prefix : pre:string -> string -> bool

prefix ~pre s returns true iff pre is a prefix of s.

val suffix : suf:string -> string -> bool

suffix ~suf s returns true iff suf is a suffix of s.

since
0.7
val chop_prefix : pre:string -> string -> string option

chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.

since
0.17
val chop_suffix : suf:string -> string -> string option

chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.

since
0.17
val take : int -> string -> string

take n s keeps only the n first chars of s.

since
0.17
val drop : int -> string -> string

drop n s removes the n first chars of s.

since
0.17
val take_drop : int -> string -> string * string

take_drop n s is take n s, drop n s.

since
0.17
val lines : string -> string list

lines s returns a list of the lines of s (splits along '\n').

since
0.10
val lines_gen : string -> string gen

lines_gen s returns a generator gen of the lines of s (splits along '\n').

since
0.10
val lines_iter : string -> string iter

lines_iter s returns the iter of the lines of s (splits along '\n').

since
3.2
val lines_seq : string -> string Stdlib.Seq.t

lines_seq s returns the Seq.t of the lines of s (splits along '\n').

since
3.2
val concat_iter : sep:string -> string iter -> string

concat_iter ~sep iter concatenates all strings of iter, separated with sep.

since
3.2
val concat_gen : sep:string -> string gen -> string

concat_gen ~sep gen concatenates all strings of gen, separated with sep.

since
0.10
val concat_seq : sep:string -> string Stdlib.Seq.t -> string

concat_seq ~sep seq concatenates all strings of seq, separated with sep.

since
3.2
val unlines : string list -> string

unlines ls concatenates all strings of ls, separated with '\n'.

since
0.10
val unlines_gen : string gen -> string

unlines_gen gen concatenates all strings of gen, separated with '\n'.

since
0.10
val unlines_iter : string iter -> string

unlines_iter iter concatenates all strings of iter, separated with '\n'.

since
3.2
val unlines_seq : string Stdlib.Seq.t -> string

unlines_seq seq concatenates all strings of seq, separated with '\n'.

since
3.2
val set : string -> int -> char -> string

set s i c creates a new string which is a copy of s, except for index i, which becomes c.

raises Invalid_argument

if i is an invalid index.

since
0.12
val iter : f:(char -> unit) -> string -> unit

iter ~f s applies function f on each character of s. Alias to String.iter.

since
0.12
val filter_map : f:(char -> char option) -> string -> string

filter_map ~f s calls (f a0) (f a1) … (f an) where a0 … an are the characters of s. It returns the string of characters ci such as f ai = Some ci (when f returns None, the corresponding element of s is discarded).

since
0.17
val filter : f:(char -> bool) -> string -> string

filter ~f s discards characters of s not satisfying f.

since
0.17
val flat_map : ?⁠sep:string -> f:(char -> string) -> string -> string

flat_map ?sep ~f s maps each chars of s to a string, then concatenates them all.

parameter sep

optional separator between each generated string.

since
0.12
val for_all : f:(char -> bool) -> string -> bool

for_all ~f s is true iff all characters of s satisfy the predicate f.

since
0.12
val exists : f:(char -> bool) -> string -> bool

exists ~f s is true iff some character of s satisfy the predicate f.

since
0.12
val drop_while : f:(char -> bool) -> t -> t

drop_while ~f s discards any characters of s starting from the left, up to the first character c not satisfying f c.

since
2.2
val rdrop_while : f:(char -> bool) -> t -> t

rdrop_while ~f s discards any characters of s starting from the right, up to the first character c not satisfying f c.

since
2.2
val ltrim : t -> t

ltrim s trims space on the left (see String.trim for more details).

since
1.2
val rtrim : t -> t

rtrim s trims space on the right (see String.trim for more details).

since
1.2

Operations on 2 strings

val map2 : f:(char -> char -> char) -> string -> string -> string

map2 ~f s1 s2 maps pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val iter2 : f:(char -> char -> unit) -> string -> string -> unit

iter2 ~f s1 s2 iterates on pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val iteri2 : f:(int -> char -> char -> unit) -> string -> string -> unit

iteri2 ~f s1 s2 iterates on pairs of chars with their index.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val fold2 : f:('a -> char -> char -> 'a) -> init:'a -> string -> string -> 'a

fold2 ~f ~init s1 s2 folds on pairs of chars.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val for_all2 : f:(char -> char -> bool) -> string -> string -> bool

for_all2 ~f s1 s2 returns true iff all pairs of chars satisfy the predicate f.

raises Invalid_argument

if the strings have not the same length.

since
0.12
val exists2 : f:(char -> char -> bool) -> string -> string -> bool

exists2 ~f s1 s2 returns true iff a pair of chars satisfy the predicate f.

raises Invalid_argument

if the strings have not the same length.

since
0.12

Ascii functions

Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.

val capitalize_ascii : string -> string

capitalize_ascii s returns a copy of s with the first character set to uppercase using the US-ASCII character set. See String.

since
0.18
val uncapitalize_ascii : string -> string

uncapitalize_ascii s returns a copy of s with the first character set to lowercase using the US-ASCII character set. See String.

since
0.18
val uppercase_ascii : string -> string

uppercase_ascii s returns a copy of s with all lowercase letters translated to uppercase using the US-ASCII character set. See String.

since
0.18
val lowercase_ascii : string -> string

lowercase_ascii s returns a copy of s with all uppercase letters translated to lowercase using the US-ASCII character set. See String.

since
0.18
val equal_caseless : string -> string -> bool

equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.

since
1.2

Finding

A relatively efficient algorithm for finding sub-strings.

since
1.0
module Find : sig ... end

Splitting

module Split : sig ... end
val split_on_char : by:char -> string -> string list

split_on_char ~by s splits the string s along the given char by.

since
1.2
val split : by:string -> string -> string list

split ~by s splits the string s along the given string by. Alias to Split.list_cpy.

since
1.2

Utils

val compare_versions : string -> string -> int

compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.

since
0.13
val compare_natural : string -> string -> int

compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order

since
1.3
val edit_distance : ?⁠cutoff:int -> string -> string -> int

edit_distance ?cutoff s1 s2 is the edition distance between the two strings s1 and s2. This satisfies the classical distance axioms: it is always positive, symmetric, and satisfies the formula distance s1 s2 + distance s2 s3 >= distance s1 s3.

parameter cutoff

if provided, it's a cap on both the number of iterations, and on the result. (since 3.0). This is useful if you just want to check whether the edit distance is less or equal than 2 (use cutoff of 3).

Infix operators

since
3.0
module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
since
3.0
val (<>) : t -> t -> bool
since
3.0
val (<) : t -> t -> bool
since
3.0
val (<=) : t -> t -> bool
since
3.0
val (>=) : t -> t -> bool
since
3.0
val (>) : t -> t -> bool
since
3.0
\ No newline at end of file diff --git a/dev/containers/Containers/Hashtbl/Make/index.html b/dev/containers/Containers/Hashtbl/Make/index.html index 7d07eee0..4bd10044 100644 --- a/dev/containers/Containers/Hashtbl/Make/index.html +++ b/dev/containers/Containers/Hashtbl/Make/index.html @@ -1,2 +1,2 @@ -Make (containers.Containers.Hashtbl.Make)

Module Hashtbl.Make

Parameters

  • H : Stdlib__hashtbl.HashedType

Signature

type key = H.t
type 'a t = 'a Stdlib__hashtbl.Make(H).t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib__hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file +Make (containers.Containers.Hashtbl.Make)

Module Hashtbl.Make

Parameters

  • H : Stdlib__hashtbl.HashedType

Signature

type key = H.t
type !'a t = 'a Stdlib__hashtbl.Make(H).t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib__hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/dev/containers/Containers/Hashtbl/MakeSeeded/index.html b/dev/containers/Containers/Hashtbl/MakeSeeded/index.html index 324ef2d5..bbce5f46 100644 --- a/dev/containers/Containers/Hashtbl/MakeSeeded/index.html +++ b/dev/containers/Containers/Hashtbl/MakeSeeded/index.html @@ -1,2 +1,2 @@ -MakeSeeded (containers.Containers.Hashtbl.MakeSeeded)

Module Hashtbl.MakeSeeded

Parameters

Signature

type key = H.t
type 'a t = 'a Stdlib__hashtbl.MakeSeeded(H).t
val create : ?⁠random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file +MakeSeeded (containers.Containers.Hashtbl.MakeSeeded)

Module Hashtbl.MakeSeeded

Parameters

Signature

type key = H.t
type !'a t = 'a Stdlib__hashtbl.MakeSeeded(H).t
val create : ?⁠random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/dev/containers/Containers/Hashtbl/index.html b/dev/containers/Containers/Hashtbl/index.html index 1873d8aa..d19afa8a 100644 --- a/dev/containers/Containers/Hashtbl/index.html +++ b/dev/containers/Containers/Hashtbl/index.html @@ -1,2 +1,2 @@ -Hashtbl (containers.Containers.Hashtbl)

Module Containers.Hashtbl

since
0.14
include module type of Stdlib.Hashtbl with type Hashtbl.statistics = Stdlib.Hashtbl.statistics and module Hashtbl.Make = Stdlib.Hashtbl.Make and type ('a, 'b) Hashtbl.t = ('a'b) Stdlib.Hashtbl.t
type ('a, 'b) t = ('a'b) Stdlib.Hashtbl.t
val create : ?⁠random:bool -> int -> ('a'b) t
val clear : ('a'b) t -> unit
val reset : ('a'b) t -> unit
val copy : ('a'b) t -> ('a'b) t
val add : ('a'b) t -> 'a -> 'b -> unit
val find : ('a'b) t -> 'a -> 'b
val find_opt : ('a'b) t -> 'a -> 'b option
val find_all : ('a'b) t -> 'a -> 'b list
val mem : ('a'b) t -> 'a -> bool
val remove : ('a'b) t -> 'a -> unit
val replace : ('a'b) t -> 'a -> 'b -> unit
val iter : ('a -> 'b -> unit) -> ('a'b) t -> unit
val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a'b) t -> unit
val fold : ('a -> 'b -> 'c -> 'c) -> ('a'b) t -> 'c -> 'c
val length : ('a'b) t -> int
val randomize : unit -> unit
val is_randomized : unit -> bool
type statistics = Stdlib.Hashtbl.statistics = {
num_bindings : int;
num_buckets : int;
max_bucket_length : int;
bucket_histogram : int array;
}
val stats : ('a'b) t -> statistics
val to_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t
val to_seq_keys : ('a'b) t -> 'a Stdlib.Seq.t
val to_seq_values : ('a'b) t -> 'b Stdlib.Seq.t
val add_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val replace_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a'b) t
module type HashedType = sig ... end
module type S = sig ... end
module Make : functor (H : Stdlib__hashtbl.HashedType) -> sig ... end
module type SeededHashedType = sig ... end
module type SeededS = sig ... end
module MakeSeeded : functor (H : SeededHashedType) -> sig ... end
val hash : 'a -> int
val seeded_hash : int -> 'a -> int
val hash_param : int -> int -> 'a -> int
val seeded_hash_param : int -> int -> int -> 'a -> int
include CCHashtbl.Poly
val get : ('a'b) Stdlib.Hashtbl.t -> 'a -> 'b option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : ('a'b) Stdlib.Hashtbl.t -> 'a -> default:'b -> 'b

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val keys : ('a'b) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : ('a'b) Stdlib.Hashtbl.t -> 'b CCHashtbl.iter

values tbl f iterates on values in the table tbl.

val keys_list : ('a'b) Stdlib.Hashtbl.t -> 'a list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : ('a'b) Stdlib.Hashtbl.t -> 'b list

values_list tbl is the list of values in tbl.

since
0.8
val map_list : ('a -> 'b -> 'c) -> ('a'b) Stdlib.Hashtbl.t -> 'c list

map_list f tbl maps on a tbl's items. Collect into a list.

val incr : ?⁠by:int -> ('a, int) Stdlib.Hashtbl.t -> 'a -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> ('a, int) Stdlib.Hashtbl.t -> 'a -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val to_iter : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter

Iterate on bindings in the table.

since
2.8
val add_list : ('a'b list) Stdlib.Hashtbl.t -> 'a -> 'b -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val add_iter : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:('a -> 'b -> 'b -> 'b) -> ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:('a -> 'b -> 'b -> 'b) -> ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : ('a * 'b) CCHashtbl.iter -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) CCHashtbl.iter -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) Stdlib.Seq.t -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : ('a, int) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : ('a, int) Stdlib.Hashtbl.t -> 'a Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from add_std_seq_count since 3.0.

since
3.0
val of_iter_count : 'a CCHashtbl.iter -> ('a, int) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : 'a Stdlib.Seq.t -> ('a, int) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : ('a * 'b) list -> ('a'b) Stdlib.Hashtbl.t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) list -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : ('a'b) Stdlib.Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : ('a'b) Stdlib.Hashtbl.t -> f:('a -> 'b) -> k:'a -> 'b

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit CCHashtbl.printer -> ?⁠pp_stop:unit CCHashtbl.printer -> ?⁠pp_sep:unit CCHashtbl.printer -> ?⁠pp_arrow:unit CCHashtbl.printer -> 'a CCHashtbl.printer -> 'b CCHashtbl.printer -> ('a'b) Stdlib.Hashtbl.t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
module type S' = CCHashtbl.S
module Make' = CCHashtbl.Make
\ No newline at end of file +Hashtbl (containers.Containers.Hashtbl)

Module Containers.Hashtbl

since
0.14
include module type of Stdlib.Hashtbl with type Hashtbl.statistics = Stdlib.Hashtbl.statistics and module Hashtbl.Make = Stdlib.Hashtbl.Make and type ('a, 'b) Hashtbl.t = ('a'b) Stdlib.Hashtbl.t
type (!'a, !'b) t = ('a'b) Stdlib.Hashtbl.t
val create : ?⁠random:bool -> int -> ('a'b) t
val clear : ('a'b) t -> unit
val reset : ('a'b) t -> unit
val copy : ('a'b) t -> ('a'b) t
val add : ('a'b) t -> 'a -> 'b -> unit
val find : ('a'b) t -> 'a -> 'b
val find_opt : ('a'b) t -> 'a -> 'b option
val find_all : ('a'b) t -> 'a -> 'b list
val mem : ('a'b) t -> 'a -> bool
val remove : ('a'b) t -> 'a -> unit
val replace : ('a'b) t -> 'a -> 'b -> unit
val iter : ('a -> 'b -> unit) -> ('a'b) t -> unit
val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a'b) t -> unit
val fold : ('a -> 'b -> 'c -> 'c) -> ('a'b) t -> 'c -> 'c
val length : ('a'b) t -> int
val randomize : unit -> unit
val is_randomized : unit -> bool
val rebuild : ?⁠random:bool -> ('a'b) t -> ('a'b) t
type statistics = Stdlib.Hashtbl.statistics = {
num_bindings : int;
num_buckets : int;
max_bucket_length : int;
bucket_histogram : int array;
}
val stats : ('a'b) t -> statistics
val to_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t
val to_seq_keys : ('a'b) t -> 'a Stdlib.Seq.t
val to_seq_values : ('a'b) t -> 'b Stdlib.Seq.t
val add_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val replace_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a'b) t
module type HashedType = sig ... end
module type S = sig ... end
module Make : functor (H : Stdlib__hashtbl.HashedType) -> sig ... end
module type SeededHashedType = sig ... end
module type SeededS = sig ... end
module MakeSeeded : functor (H : SeededHashedType) -> sig ... end
val hash : 'a -> int
val seeded_hash : int -> 'a -> int
val hash_param : int -> int -> 'a -> int
val seeded_hash_param : int -> int -> int -> 'a -> int
include CCHashtbl.Poly
val get : ('a'b) Stdlib.Hashtbl.t -> 'a -> 'b option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : ('a'b) Stdlib.Hashtbl.t -> 'a -> default:'b -> 'b

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val keys : ('a'b) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : ('a'b) Stdlib.Hashtbl.t -> 'b CCHashtbl.iter

values tbl f iterates on values in the table tbl.

val keys_list : ('a'b) Stdlib.Hashtbl.t -> 'a list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : ('a'b) Stdlib.Hashtbl.t -> 'b list

values_list tbl is the list of values in tbl.

since
0.8
val map_list : ('a -> 'b -> 'c) -> ('a'b) Stdlib.Hashtbl.t -> 'c list

map_list f tbl maps on a tbl's items. Collect into a list.

val incr : ?⁠by:int -> ('a, int) Stdlib.Hashtbl.t -> 'a -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> ('a, int) Stdlib.Hashtbl.t -> 'a -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val to_iter : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter

Iterate on bindings in the table.

since
2.8
val add_list : ('a'b list) Stdlib.Hashtbl.t -> 'a -> 'b -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val add_iter : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:('a -> 'b -> 'b -> 'b) -> ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:('a -> 'b -> 'b -> 'b) -> ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : ('a * 'b) CCHashtbl.iter -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) CCHashtbl.iter -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) Stdlib.Seq.t -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : ('a, int) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : ('a, int) Stdlib.Hashtbl.t -> 'a Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from add_std_seq_count since 3.0.

since
3.0
val of_iter_count : 'a CCHashtbl.iter -> ('a, int) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : 'a Stdlib.Seq.t -> ('a, int) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : ('a * 'b) list -> ('a'b) Stdlib.Hashtbl.t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) list -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : ('a'b) Stdlib.Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : ('a'b) Stdlib.Hashtbl.t -> f:('a -> 'b) -> k:'a -> 'b

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit CCHashtbl.printer -> ?⁠pp_stop:unit CCHashtbl.printer -> ?⁠pp_sep:unit CCHashtbl.printer -> ?⁠pp_arrow:unit CCHashtbl.printer -> 'a CCHashtbl.printer -> 'b CCHashtbl.printer -> ('a'b) Stdlib.Hashtbl.t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
module type S' = CCHashtbl.S
module Make' = CCHashtbl.Make
\ No newline at end of file diff --git a/dev/containers/Containers/Hashtbl/module-type-S'/index.html b/dev/containers/Containers/Hashtbl/module-type-S'/index.html index dc5e1f27..0c7ea33f 100644 --- a/dev/containers/Containers/Hashtbl/module-type-S'/index.html +++ b/dev/containers/Containers/Hashtbl/module-type-S'/index.html @@ -1,2 +1,2 @@ -S' (containers.Containers.Hashtbl.S')

Module type Hashtbl.S'

include Stdlib.Hashtbl.S
type key
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : 'a t -> key -> 'a option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : 'a t -> key -> default:'a -> 'a

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val add_list : 'a list t -> key -> 'a -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val incr : ?⁠by:int -> int t -> key -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> int t -> key -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val keys : 'a t -> key CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : 'a t -> 'a CCHashtbl.iter

values tbl f iterates on values in the table.

val keys_list : _ t -> key list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : 'a t -> 'a list

values_list t is the list of values in t.

since
0.8
val map_list : (key -> 'a -> 'b) -> 'a t -> 'b list

Map on a hashtable's items, collect into a list.

val to_iter : 'a t -> (key * 'a) CCHashtbl.iter

Iterate on bindings in the table.

since
2.8
val add_iter : 'a t -> (key * 'a) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : (key * 'a) CCHashtbl.iter -> 'a t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) CCHashtbl.iter -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : int t -> key CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : int t -> key Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from of_std_seq_count since 3.0.

since
3.0
val of_iter_count : key CCHashtbl.iter -> int t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : key Stdlib.Seq.t -> int t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : 'a t -> (key * 'a) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : 'a t -> f:(key -> 'a) -> k:key -> 'a

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit CCHashtbl.printer -> ?⁠pp_stop:unit CCHashtbl.printer -> ?⁠pp_sep:unit CCHashtbl.printer -> ?⁠pp_arrow:unit CCHashtbl.printer -> key CCHashtbl.printer -> 'a CCHashtbl.printer -> 'a t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
\ No newline at end of file +S' (containers.Containers.Hashtbl.S')

Module type Hashtbl.S'

include Stdlib.Hashtbl.S
type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : 'a t -> key -> 'a option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : 'a t -> key -> default:'a -> 'a

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val add_list : 'a list t -> key -> 'a -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val incr : ?⁠by:int -> int t -> key -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> int t -> key -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val keys : 'a t -> key CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : 'a t -> 'a CCHashtbl.iter

values tbl f iterates on values in the table.

val keys_list : _ t -> key list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : 'a t -> 'a list

values_list t is the list of values in t.

since
0.8
val map_list : (key -> 'a -> 'b) -> 'a t -> 'b list

Map on a hashtable's items, collect into a list.

val to_iter : 'a t -> (key * 'a) CCHashtbl.iter

Iterate on bindings in the table.

since
2.8
val add_iter : 'a t -> (key * 'a) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : (key * 'a) CCHashtbl.iter -> 'a t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) CCHashtbl.iter -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : int t -> key CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : int t -> key Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from of_std_seq_count since 3.0.

since
3.0
val of_iter_count : key CCHashtbl.iter -> int t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : key Stdlib.Seq.t -> int t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : 'a t -> (key * 'a) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : 'a t -> f:(key -> 'a) -> k:key -> 'a

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit CCHashtbl.printer -> ?⁠pp_stop:unit CCHashtbl.printer -> ?⁠pp_sep:unit CCHashtbl.printer -> ?⁠pp_arrow:unit CCHashtbl.printer -> key CCHashtbl.printer -> 'a CCHashtbl.printer -> 'a t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
\ No newline at end of file diff --git a/dev/containers/Containers/Hashtbl/module-type-S/index.html b/dev/containers/Containers/Hashtbl/module-type-S/index.html index 6dc11501..aa696bc5 100644 --- a/dev/containers/Containers/Hashtbl/module-type-S/index.html +++ b/dev/containers/Containers/Hashtbl/module-type-S/index.html @@ -1,2 +1,2 @@ -S (containers.Containers.Hashtbl.S)

Module type Hashtbl.S

type key
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file +S (containers.Containers.Hashtbl.S)

Module type Hashtbl.S

type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/dev/containers/Containers/Hashtbl/module-type-SeededS/index.html b/dev/containers/Containers/Hashtbl/module-type-SeededS/index.html index 35702b9b..f84411fc 100644 --- a/dev/containers/Containers/Hashtbl/module-type-SeededS/index.html +++ b/dev/containers/Containers/Hashtbl/module-type-SeededS/index.html @@ -1,2 +1,2 @@ -SeededS (containers.Containers.Hashtbl.SeededS)

Module type Hashtbl.SeededS

type key
type 'a t
val create : ?⁠random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file +SeededS (containers.Containers.Hashtbl.SeededS)

Module type Hashtbl.SeededS

type key
type !'a t
val create : ?⁠random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/dev/containers/ContainersLabels/Hashtbl/Make/index.html b/dev/containers/ContainersLabels/Hashtbl/Make/index.html index 18468ec0..31eef906 100644 --- a/dev/containers/ContainersLabels/Hashtbl/Make/index.html +++ b/dev/containers/ContainersLabels/Hashtbl/Make/index.html @@ -1,2 +1,2 @@ -Make (containers.ContainersLabels.Hashtbl.Make)

Module Hashtbl.Make

Parameters

  • H : Stdlib__hashtbl.HashedType

Signature

type key = H.t
type 'a t = 'a Stdlib__hashtbl.Make(H).t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib__hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file +Make (containers.ContainersLabels.Hashtbl.Make)

Module Hashtbl.Make

Parameters

  • H : Stdlib__hashtbl.HashedType

Signature

type key = H.t
type !'a t = 'a Stdlib__hashtbl.Make(H).t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib__hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/dev/containers/ContainersLabels/Hashtbl/MakeSeeded/index.html b/dev/containers/ContainersLabels/Hashtbl/MakeSeeded/index.html index c5eab6dc..173eb65c 100644 --- a/dev/containers/ContainersLabels/Hashtbl/MakeSeeded/index.html +++ b/dev/containers/ContainersLabels/Hashtbl/MakeSeeded/index.html @@ -1,2 +1,2 @@ -MakeSeeded (containers.ContainersLabels.Hashtbl.MakeSeeded)

Module Hashtbl.MakeSeeded

Parameters

Signature

type key = H.t
type 'a t = 'a Stdlib__hashtbl.MakeSeeded(H).t
val create : ?⁠random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file +MakeSeeded (containers.ContainersLabels.Hashtbl.MakeSeeded)

Module Hashtbl.MakeSeeded

Parameters

Signature

type key = H.t
type !'a t = 'a Stdlib__hashtbl.MakeSeeded(H).t
val create : ?⁠random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/dev/containers/ContainersLabels/Hashtbl/index.html b/dev/containers/ContainersLabels/Hashtbl/index.html index 61c1d6c4..87c78145 100644 --- a/dev/containers/ContainersLabels/Hashtbl/index.html +++ b/dev/containers/ContainersLabels/Hashtbl/index.html @@ -1,2 +1,2 @@ -Hashtbl (containers.ContainersLabels.Hashtbl)

Module ContainersLabels.Hashtbl

since
0.14
include module type of Stdlib.Hashtbl with type Hashtbl.statistics = Stdlib.Hashtbl.statistics and module Hashtbl.Make = Stdlib.Hashtbl.Make and type ('a, 'b) Hashtbl.t = ('a'b) Stdlib.Hashtbl.t
type ('a, 'b) t = ('a'b) Stdlib.Hashtbl.t
val create : ?⁠random:bool -> int -> ('a'b) t
val clear : ('a'b) t -> unit
val reset : ('a'b) t -> unit
val copy : ('a'b) t -> ('a'b) t
val add : ('a'b) t -> 'a -> 'b -> unit
val find : ('a'b) t -> 'a -> 'b
val find_opt : ('a'b) t -> 'a -> 'b option
val find_all : ('a'b) t -> 'a -> 'b list
val mem : ('a'b) t -> 'a -> bool
val remove : ('a'b) t -> 'a -> unit
val replace : ('a'b) t -> 'a -> 'b -> unit
val iter : ('a -> 'b -> unit) -> ('a'b) t -> unit
val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a'b) t -> unit
val fold : ('a -> 'b -> 'c -> 'c) -> ('a'b) t -> 'c -> 'c
val length : ('a'b) t -> int
val randomize : unit -> unit
val is_randomized : unit -> bool
type statistics = Stdlib.Hashtbl.statistics = {
num_bindings : int;
num_buckets : int;
max_bucket_length : int;
bucket_histogram : int array;
}
val stats : ('a'b) t -> statistics
val to_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t
val to_seq_keys : ('a'b) t -> 'a Stdlib.Seq.t
val to_seq_values : ('a'b) t -> 'b Stdlib.Seq.t
val add_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val replace_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a'b) t
module type HashedType = sig ... end
module type S = sig ... end
module Make : functor (H : Stdlib__hashtbl.HashedType) -> sig ... end
module type SeededHashedType = sig ... end
module type SeededS = sig ... end
module MakeSeeded : functor (H : SeededHashedType) -> sig ... end
val hash : 'a -> int
val seeded_hash : int -> 'a -> int
val hash_param : int -> int -> 'a -> int
val seeded_hash_param : int -> int -> int -> 'a -> int
include CCHashtbl.Poly
val get : ('a'b) Stdlib.Hashtbl.t -> 'a -> 'b option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : ('a'b) Stdlib.Hashtbl.t -> 'a -> default:'b -> 'b

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val keys : ('a'b) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : ('a'b) Stdlib.Hashtbl.t -> 'b CCHashtbl.iter

values tbl f iterates on values in the table tbl.

val keys_list : ('a'b) Stdlib.Hashtbl.t -> 'a list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : ('a'b) Stdlib.Hashtbl.t -> 'b list

values_list tbl is the list of values in tbl.

since
0.8
val map_list : ('a -> 'b -> 'c) -> ('a'b) Stdlib.Hashtbl.t -> 'c list

map_list f tbl maps on a tbl's items. Collect into a list.

val incr : ?⁠by:int -> ('a, int) Stdlib.Hashtbl.t -> 'a -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> ('a, int) Stdlib.Hashtbl.t -> 'a -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val to_iter : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter

Iterate on bindings in the table.

since
2.8
val add_list : ('a'b list) Stdlib.Hashtbl.t -> 'a -> 'b -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val add_iter : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:('a -> 'b -> 'b -> 'b) -> ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:('a -> 'b -> 'b -> 'b) -> ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : ('a * 'b) CCHashtbl.iter -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) CCHashtbl.iter -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) Stdlib.Seq.t -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : ('a, int) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : ('a, int) Stdlib.Hashtbl.t -> 'a Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from add_std_seq_count since 3.0.

since
3.0
val of_iter_count : 'a CCHashtbl.iter -> ('a, int) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : 'a Stdlib.Seq.t -> ('a, int) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : ('a * 'b) list -> ('a'b) Stdlib.Hashtbl.t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) list -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : ('a'b) Stdlib.Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : ('a'b) Stdlib.Hashtbl.t -> f:('a -> 'b) -> k:'a -> 'b

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit CCHashtbl.printer -> ?⁠pp_stop:unit CCHashtbl.printer -> ?⁠pp_sep:unit CCHashtbl.printer -> ?⁠pp_arrow:unit CCHashtbl.printer -> 'a CCHashtbl.printer -> 'b CCHashtbl.printer -> ('a'b) Stdlib.Hashtbl.t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
module type S' = CCHashtbl.S
module Make' = CCHashtbl.Make
\ No newline at end of file +Hashtbl (containers.ContainersLabels.Hashtbl)

Module ContainersLabels.Hashtbl

since
0.14
include module type of Stdlib.Hashtbl with type Hashtbl.statistics = Stdlib.Hashtbl.statistics and module Hashtbl.Make = Stdlib.Hashtbl.Make and type ('a, 'b) Hashtbl.t = ('a'b) Stdlib.Hashtbl.t
type (!'a, !'b) t = ('a'b) Stdlib.Hashtbl.t
val create : ?⁠random:bool -> int -> ('a'b) t
val clear : ('a'b) t -> unit
val reset : ('a'b) t -> unit
val copy : ('a'b) t -> ('a'b) t
val add : ('a'b) t -> 'a -> 'b -> unit
val find : ('a'b) t -> 'a -> 'b
val find_opt : ('a'b) t -> 'a -> 'b option
val find_all : ('a'b) t -> 'a -> 'b list
val mem : ('a'b) t -> 'a -> bool
val remove : ('a'b) t -> 'a -> unit
val replace : ('a'b) t -> 'a -> 'b -> unit
val iter : ('a -> 'b -> unit) -> ('a'b) t -> unit
val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a'b) t -> unit
val fold : ('a -> 'b -> 'c -> 'c) -> ('a'b) t -> 'c -> 'c
val length : ('a'b) t -> int
val randomize : unit -> unit
val is_randomized : unit -> bool
val rebuild : ?⁠random:bool -> ('a'b) t -> ('a'b) t
type statistics = Stdlib.Hashtbl.statistics = {
num_bindings : int;
num_buckets : int;
max_bucket_length : int;
bucket_histogram : int array;
}
val stats : ('a'b) t -> statistics
val to_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t
val to_seq_keys : ('a'b) t -> 'a Stdlib.Seq.t
val to_seq_values : ('a'b) t -> 'b Stdlib.Seq.t
val add_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val replace_seq : ('a'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a'b) t
module type HashedType = sig ... end
module type S = sig ... end
module Make : functor (H : Stdlib__hashtbl.HashedType) -> sig ... end
module type SeededHashedType = sig ... end
module type SeededS = sig ... end
module MakeSeeded : functor (H : SeededHashedType) -> sig ... end
val hash : 'a -> int
val seeded_hash : int -> 'a -> int
val hash_param : int -> int -> 'a -> int
val seeded_hash_param : int -> int -> int -> 'a -> int
include CCHashtbl.Poly
val get : ('a'b) Stdlib.Hashtbl.t -> 'a -> 'b option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : ('a'b) Stdlib.Hashtbl.t -> 'a -> default:'b -> 'b

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val keys : ('a'b) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : ('a'b) Stdlib.Hashtbl.t -> 'b CCHashtbl.iter

values tbl f iterates on values in the table tbl.

val keys_list : ('a'b) Stdlib.Hashtbl.t -> 'a list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : ('a'b) Stdlib.Hashtbl.t -> 'b list

values_list tbl is the list of values in tbl.

since
0.8
val map_list : ('a -> 'b -> 'c) -> ('a'b) Stdlib.Hashtbl.t -> 'c list

map_list f tbl maps on a tbl's items. Collect into a list.

val incr : ?⁠by:int -> ('a, int) Stdlib.Hashtbl.t -> 'a -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> ('a, int) Stdlib.Hashtbl.t -> 'a -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val to_iter : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter

Iterate on bindings in the table.

since
2.8
val add_list : ('a'b list) Stdlib.Hashtbl.t -> 'a -> 'b -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val add_iter : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:('a -> 'b -> 'b -> 'b) -> ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:('a -> 'b -> 'b -> 'b) -> ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : ('a * 'b) CCHashtbl.iter -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) CCHashtbl.iter -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) Stdlib.Seq.t -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : ('a, int) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : ('a, int) Stdlib.Hashtbl.t -> 'a Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from add_std_seq_count since 3.0.

since
3.0
val of_iter_count : 'a CCHashtbl.iter -> ('a, int) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : 'a Stdlib.Seq.t -> ('a, int) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : ('a * 'b) list -> ('a'b) Stdlib.Hashtbl.t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:('a -> 'b -> 'b -> 'b) -> ('a * 'b) list -> ('a'b) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : ('a'b) Stdlib.Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : ('a'b) Stdlib.Hashtbl.t -> f:('a -> 'b) -> k:'a -> 'b

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit CCHashtbl.printer -> ?⁠pp_stop:unit CCHashtbl.printer -> ?⁠pp_sep:unit CCHashtbl.printer -> ?⁠pp_arrow:unit CCHashtbl.printer -> 'a CCHashtbl.printer -> 'b CCHashtbl.printer -> ('a'b) Stdlib.Hashtbl.t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
module type S' = CCHashtbl.S
module Make' = CCHashtbl.Make
\ No newline at end of file diff --git a/dev/containers/ContainersLabels/Hashtbl/module-type-S'/index.html b/dev/containers/ContainersLabels/Hashtbl/module-type-S'/index.html index 94b5c1a5..556a0ee4 100644 --- a/dev/containers/ContainersLabels/Hashtbl/module-type-S'/index.html +++ b/dev/containers/ContainersLabels/Hashtbl/module-type-S'/index.html @@ -1,2 +1,2 @@ -S' (containers.ContainersLabels.Hashtbl.S')

Module type Hashtbl.S'

include Stdlib.Hashtbl.S
type key
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : 'a t -> key -> 'a option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : 'a t -> key -> default:'a -> 'a

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val add_list : 'a list t -> key -> 'a -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val incr : ?⁠by:int -> int t -> key -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> int t -> key -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val keys : 'a t -> key CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : 'a t -> 'a CCHashtbl.iter

values tbl f iterates on values in the table.

val keys_list : _ t -> key list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : 'a t -> 'a list

values_list t is the list of values in t.

since
0.8
val map_list : (key -> 'a -> 'b) -> 'a t -> 'b list

Map on a hashtable's items, collect into a list.

val to_iter : 'a t -> (key * 'a) CCHashtbl.iter

Iterate on bindings in the table.

since
2.8
val add_iter : 'a t -> (key * 'a) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : (key * 'a) CCHashtbl.iter -> 'a t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) CCHashtbl.iter -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : int t -> key CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : int t -> key Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from of_std_seq_count since 3.0.

since
3.0
val of_iter_count : key CCHashtbl.iter -> int t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : key Stdlib.Seq.t -> int t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : 'a t -> (key * 'a) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : 'a t -> f:(key -> 'a) -> k:key -> 'a

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit CCHashtbl.printer -> ?⁠pp_stop:unit CCHashtbl.printer -> ?⁠pp_sep:unit CCHashtbl.printer -> ?⁠pp_arrow:unit CCHashtbl.printer -> key CCHashtbl.printer -> 'a CCHashtbl.printer -> 'a t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
\ No newline at end of file +S' (containers.ContainersLabels.Hashtbl.S')

Module type Hashtbl.S'

include Stdlib.Hashtbl.S
type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib.Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : 'a t -> key -> 'a option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : 'a t -> key -> default:'a -> 'a

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

since
0.16
val add_list : 'a list t -> key -> 'a -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

since
0.16
val incr : ?⁠by:int -> int t -> key -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

parameter by

if specified, the int value is incremented by by rather than 1.

since
0.16
val decr : ?⁠by:int -> int t -> key -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

since
0.16
val keys : 'a t -> key CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : 'a t -> 'a CCHashtbl.iter

values tbl f iterates on values in the table.

val keys_list : _ t -> key list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

since
0.8
val values_list : 'a t -> 'a list

values_list t is the list of values in t.

since
0.8
val map_list : (key -> 'a -> 'b) -> 'a t -> 'b list

Map on a hashtable's items, collect into a list.

val to_iter : 'a t -> (key * 'a) CCHashtbl.iter

Iterate on bindings in the table.

since
2.8
val add_iter : 'a t -> (key * 'a) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

since
2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

since
3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_iter : (key * 'a) CCHashtbl.iter -> 'a t

From the given bindings, added in order.

since
2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) CCHashtbl.iter -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

since
3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val add_iter_count : int t -> key CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

since
2.8
val add_seq_count : int t -> key Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from of_std_seq_count since 3.0.

since
3.0
val of_iter_count : key CCHashtbl.iter -> int t

Like add_seq_count, but allocates a new table and returns it.

since
2.8
val of_seq_count : key Stdlib.Seq.t -> int t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

since
3.0
val to_list : 'a t -> (key * 'a) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

since
3.3
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

since
0.14
val get_or_add : 'a t -> f:(key -> 'a) -> k:key -> 'a

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

since
1.0
val pp : ?⁠pp_start:unit CCHashtbl.printer -> ?⁠pp_stop:unit CCHashtbl.printer -> ?⁠pp_sep:unit CCHashtbl.printer -> ?⁠pp_arrow:unit CCHashtbl.printer -> key CCHashtbl.printer -> 'a CCHashtbl.printer -> 'a t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

since
0.13
\ No newline at end of file diff --git a/dev/containers/ContainersLabels/Hashtbl/module-type-S/index.html b/dev/containers/ContainersLabels/Hashtbl/module-type-S/index.html index ac13a67c..f7ec2a0c 100644 --- a/dev/containers/ContainersLabels/Hashtbl/module-type-S/index.html +++ b/dev/containers/ContainersLabels/Hashtbl/module-type-S/index.html @@ -1,2 +1,2 @@ -S (containers.ContainersLabels.Hashtbl.S)

Module type Hashtbl.S

type key
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file +S (containers.ContainersLabels.Hashtbl.S)

Module type Hashtbl.S

type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/dev/containers/ContainersLabels/Hashtbl/module-type-SeededS/index.html b/dev/containers/ContainersLabels/Hashtbl/module-type-SeededS/index.html index 86f45d40..310bc883 100644 --- a/dev/containers/ContainersLabels/Hashtbl/module-type-SeededS/index.html +++ b/dev/containers/ContainersLabels/Hashtbl/module-type-SeededS/index.html @@ -1,2 +1,2 @@ -SeededS (containers.ContainersLabels.Hashtbl.SeededS)

Module type Hashtbl.SeededS

type key
type 'a t
val create : ?⁠random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file +SeededS (containers.ContainersLabels.Hashtbl.SeededS)

Module type Hashtbl.SeededS

type key
type !'a t
val create : ?⁠random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file