\ No newline at end of file
diff --git a/dev/containers/CCFormat/Infix/index.html b/dev/containers/CCFormat/Infix/index.html
index acb104f9..1568fb3d 100644
--- a/dev/containers/CCFormat/Infix/index.html
+++ b/dev/containers/CCFormat/Infix/index.html
@@ -1,2 +1,2 @@
-Infix (containers.CCFormat.Infix)
\ No newline at end of file
diff --git a/dev/containers/CCFormat/index.html b/dev/containers/CCFormat/index.html
index 3ad7f570..77b0b56d 100644
--- a/dev/containers/CCFormat/index.html
+++ b/dev/containers/CCFormat/index.html
@@ -1,5 +1,5 @@
-CCFormat (containers.CCFormat)
val ksprintf : (string ->'a)->('b, unit, string, 'a) Stdlib.format4->'b
val kasprintf : (string ->'a)->('b, formatter, unit, 'a) Stdlib.format4->'b
val bprintf : Stdlib.Buffer.t ->('a, formatter, 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 ksprintf : (string ->'a)->('b, unit, string, 'a) Stdlib.format4->'b
val kasprintf : (string ->'a)->('b, formatter, unit, 'a) Stdlib.format4->'b
val bprintf : Stdlib.Buffer.t ->('a, formatter, 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)
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_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.
\ No newline at end of file
diff --git a/dev/containers/CCList/index.html b/dev/containers/CCList/index.html
index 61693ca0..18a722b4 100644
--- a/dev/containers/CCList/index.html
+++ b/dev/containers/CCList/index.html
@@ -1,9 +1,9 @@
-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
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_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.
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.
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:
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_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.
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.
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:
invariant: cartesian_product l = map_product id l.
since
1.2, but only
since
2.2 with labels
val map_product_l : ('a->'b list)->'a list->'b list list
map_product_l f l maps each element of l to a list of objects of type 'b using f. We obtain [l1; l2; …; ln] where length l=n and li : 'b list. Then, it returns all the ways of picking exactly one element per li.
diagonal l returns all pairs of distinct positions of the list l, that is the list of List.nth i l, List.nth j l if i < j.
val partition_map : ('a->[< `Left of 'b| `Right of 'c| `Drop ])->'a list->'b list * 'c list
partition_map f l maps f on l and gather results in lists:
if f x = `Left y, adds y to the first list.
if f x = `Right z, adds z to the second list.
if f x = `Drop, ignores x.
since
0.11
val group_by : ?hash:('a-> int)->?eq:('a->'a-> bool)->'at->'a listt
group_by ?hash ?eq l groups equal elements, regardless of their order of appearance. precondition: for any x and y, if eq x y then hash x=hash y must hold.
since
2.3
val join : join_row:('a->'b->'c option)->'at->'bt->'ct
join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.
since
2.3
val join_by : ?eq:('key->'key-> bool)->?hash:('key-> int)->('a->'key)->('b->'key)->merge:('key->'a->'b->'c option)->'at->'bt->'ct
join_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded. precondition: for any x and y, if eq x y then hash x=hash y must hold.
since
2.3
val join_all_by : ?eq:('key->'key-> bool)->?hash:('key-> int)->('a->'key)->('b->'key)->merge:('key->'a list->'b list->'c option)->'at->'bt->'ct
join_all_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and, for each key k occurring in at least one of them:
compute the list l1 of elements of a that map to k
compute the list l2 of elements of b that map to k
call merge k l1 l2. If merge returns None, the combination of values is discarded, otherwise it returns Some c and c is inserted in the result.
since
2.3
val group_join_by : ?eq:('a->'a-> bool)->?hash:('a-> int)->('b->'a)->'at->'bt->('a * 'b list)t
group_join_by ?eq ?hash key la lb associates to every element x of the first sequence, all the elements y of the second sequence such that eq x (key y). Elements of the first sequences without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x=hash y must hold.
since
2.3
val sublists_of_len : ?last:('a list->'a list option)->?offset:int-> int ->'a list->'a list list
sublists_of_len ?last ?offset n l returns sub-lists of l that have length n. By default, these sub-lists are non overlapping: sublists_of_len 2 [1;2;3;4;5;6] returns [1;2]; [3;4]; [5;6].
the number of elements skipped between two consecutive sub-lists. By default it is n. If offset < n, the sub-lists will overlap; if offset > n, some elements will not appear at all.
parameter last
if provided and the last group of elements g is such that length g < n, last g is called. If last g = Some g', g' is appended; otherwise g is dropped. If last = CCOpt.return, it will simply keep the last group. By default, last = fun _ -> None, i.e. the last group is dropped if shorter than n.
chunks n l returns consecutives chunks of size at most n from l. Each item of l will occur in exactly one chunk. Only the last chunk might be of length smaller than n. Invariant: (chunks n l |> List.flatten) = l.
since
NEXT_RELEASE
val intersperse : 'a->'a list->'a list
intersperse x l inserts the element x between adjacent elements of the list l.
since
2.1, but only
since
2.2 with labels
val interleave : 'a list->'a list->'a list
interleave [x1…xn] [y1…ym] is [x1;y1;x2;y2;…] and finishes with the suffix of the longest list.
mguard c is pure () if c is true, [] otherwise. This is useful to define a list by comprehension, e.g.:
# let square_even xs =
+[[1;3;4;5;6];[2;3;4;5;6]];;
invariant: cartesian_product l = map_product id l.
since
1.2, but only
since
2.2 with labels
val map_product_l : ('a->'b list)->'a list->'b list list
map_product_l f l maps each element of l to a list of objects of type 'b using f. We obtain [l1; l2; …; ln] where length l=n and li : 'b list. Then, it returns all the ways of picking exactly one element per li.
diagonal l returns all pairs of distinct positions of the list l, that is the list of List.nth i l, List.nth j l if i < j.
val partition_map : ('a->[< `Left of 'b| `Right of 'c| `Drop ])->'a list->'b list * 'c list
partition_map f l maps f on l and gather results in lists:
if f x = `Left y, adds y to the first list.
if f x = `Right z, adds z to the second list.
if f x = `Drop, ignores x.
since
0.11
val group_by : ?hash:('a-> int)->?eq:('a->'a-> bool)->'at->'a listt
group_by ?hash ?eq l groups equal elements, regardless of their order of appearance. precondition: for any x and y, if eq x y then hash x=hash y must hold.
since
2.3
val join : join_row:('a->'b->'c option)->'at->'bt->'ct
join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.
since
2.3
val join_by : ?eq:('key->'key-> bool)->?hash:('key-> int)->('a->'key)->('b->'key)->merge:('key->'a->'b->'c option)->'at->'bt->'ct
join_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded. precondition: for any x and y, if eq x y then hash x=hash y must hold.
since
2.3
val join_all_by : ?eq:('key->'key-> bool)->?hash:('key-> int)->('a->'key)->('b->'key)->merge:('key->'a list->'b list->'c option)->'at->'bt->'ct
join_all_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and, for each key k occurring in at least one of them:
compute the list l1 of elements of a that map to k
compute the list l2 of elements of b that map to k
call merge k l1 l2. If merge returns None, the combination of values is discarded, otherwise it returns Some c and c is inserted in the result.
since
2.3
val group_join_by : ?eq:('a->'a-> bool)->?hash:('a-> int)->('b->'a)->'at->'bt->('a * 'b list)t
group_join_by ?eq ?hash key la lb associates to every element x of the first sequence, all the elements y of the second sequence such that eq x (key y). Elements of the first sequences without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x=hash y must hold.
since
2.3
val sublists_of_len : ?last:('a list->'a list option)->?offset:int-> int ->'a list->'a list list
sublists_of_len ?last ?offset n l returns sub-lists of l that have length n. By default, these sub-lists are non overlapping: sublists_of_len 2 [1;2;3;4;5;6] returns [1;2]; [3;4]; [5;6].
the number of elements skipped between two consecutive sub-lists. By default it is n. If offset < n, the sub-lists will overlap; if offset > n, some elements will not appear at all.
parameter last
if provided and the last group of elements g is such that length g < n, last g is called. If last g = Some g', g' is appended; otherwise g is dropped. If last = CCOpt.return, it will simply keep the last group. By default, last = fun _ -> None, i.e. the last group is dropped if shorter than n.
chunks n l returns consecutives chunks of size at most n from l. Each item of l will occur in exactly one chunk. Only the last chunk might be of length smaller than n. Invariant: (chunks n l |> List.flatten) = l.
since
3.2
val intersperse : 'a->'a list->'a list
intersperse x l inserts the element x between adjacent elements of the list l.
since
2.1, but only
since
2.2 with labels
val interleave : 'a list->'a list->'a list
interleave [x1…xn] [y1…ym] is [x1;y1;x2;y2;…] and finishes with the suffix of the longest list.
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_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.
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.
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:
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_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.
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.
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:
invariant: cartesian_product l = map_product id l.
since
1.2, but only
since
2.2 with labels
val map_product_l : f:('a->'b list)->'a list->'b list list
map_product_l ~f l maps each element of l to a list of objects of type 'b using f. We obtain [l1; l2; …; ln] where length l=n and li : 'b list. Then, it returns all the ways of picking exactly one element per li.
diagonal l returns all pairs of distinct positions of the list l, that is the list of List.nth i l, List.nth j l if i < j.
val partition_map : f:('a->[< `Left of 'b| `Right of 'c| `Drop ])->'a list->'b list * 'c list
partition_map ~f l maps f on l and gather results in lists:
if f x = `Left y, adds y to the first list.
if f x = `Right z, adds z to the second list.
if f x = `Drop, ignores x.
since
0.11
val group_by : ?hash:('a-> int)->?eq:('a->'a-> bool)->'at->'a listt
group_by ?hash ?eq l groups equal elements, regardless of their order of appearance. precondition: for any x and y, if eq x y then hash x = hash y must hold.
since
2.3
val join : join_row:('a->'b->'c option)->'at->'bt->'ct
join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.
since
2.3
val join_by : ?eq:('key->'key-> bool)->?hash:('key-> int)->('a->'key)->('b->'key)->merge:('key->'a->'b->'c option)->'at->'bt->'ct
join_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded. precondition: for any x and y, if eq x y then hash x = hash y must hold.
since
2.3
val join_all_by : ?eq:('key->'key-> bool)->?hash:('key-> int)->('a->'key)->('b->'key)->merge:('key->'a list->'b list->'c option)->'at->'bt->'ct
join_all_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and, for each key k occurring in at least one of them:
compute the list l1 of elements of a that map to k
compute the list l2 of elements of b that map to k
call merge k l1 l2. If merge returns None, the combination of values is discarded, otherwise it returns Some c and c is inserted in the result.
since
2.3
val group_join_by : ?eq:('a->'a-> bool)->?hash:('a-> int)->('b->'a)->'at->'bt->('a * 'b list)t
group_join_by ?eq ?hash key la lb associates to every element x of the first sequence, all the elements y of the second sequence such that eq x (key y). Elements of the first sequences without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x = hash y must hold.
since
2.3
val sublists_of_len : ?last:('a list->'a list option)->?offset:int->len:int->'a list->'a list list
sublists_of_len ?last ?offset n l returns sub-lists of l that have length n. By default, these sub-lists are non overlapping: sublists_of_len 2 [1;2;3;4;5;6] returns [1;2]; [3;4]; [5;6].
the number of elements skipped between two consecutive sub-lists. By default it is n. If offset < n, the sub-lists will overlap; if offset > n, some elements will not appear at all.
parameter last
if provided and the last group of elements g is such that length g < n, last g is called. If last g = Some g', g' is appended; otherwise g is dropped. If last = CCOpt.return, it will simply keep the last group. By default, last = fun _ -> None, i.e. the last group is dropped if shorter than n.
chunks n l returns consecutives chunks of size at most n from l. Each item of l will occur in exactly one chunk. Only the last chunk might be of length smaller than n. Invariant: (chunks n l |> List.flatten) = l.
since
NEXT_RELEASE
val intersperse : x:'a->'a list->'a list
intersperse ~x l inserts the element x between adjacent elements of the list l.
since
2.1, but only
since
2.2 with labels
val interleave : 'a list->'a list->'a list
interleave [x1…xn] [y1…ym] is [x1,y1,x2,y2,…] and finishes with the suffix of the longest list.
mguard c is pure () if c is true, [] otherwise. This is useful to define a list by comprehension, e.g.:
# let square_even xs =
+[[1;3;4;5;6];[2;3;4;5;6]];;
invariant: cartesian_product l = map_product id l.
since
1.2, but only
since
2.2 with labels
val map_product_l : f:('a->'b list)->'a list->'b list list
map_product_l ~f l maps each element of l to a list of objects of type 'b using f. We obtain [l1; l2; …; ln] where length l=n and li : 'b list. Then, it returns all the ways of picking exactly one element per li.
diagonal l returns all pairs of distinct positions of the list l, that is the list of List.nth i l, List.nth j l if i < j.
val partition_map : f:('a->[< `Left of 'b| `Right of 'c| `Drop ])->'a list->'b list * 'c list
partition_map ~f l maps f on l and gather results in lists:
if f x = `Left y, adds y to the first list.
if f x = `Right z, adds z to the second list.
if f x = `Drop, ignores x.
since
0.11
val group_by : ?hash:('a-> int)->?eq:('a->'a-> bool)->'at->'a listt
group_by ?hash ?eq l groups equal elements, regardless of their order of appearance. precondition: for any x and y, if eq x y then hash x = hash y must hold.
since
2.3
val join : join_row:('a->'b->'c option)->'at->'bt->'ct
join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.
since
2.3
val join_by : ?eq:('key->'key-> bool)->?hash:('key-> int)->('a->'key)->('b->'key)->merge:('key->'a->'b->'c option)->'at->'bt->'ct
join_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded. precondition: for any x and y, if eq x y then hash x = hash y must hold.
since
2.3
val join_all_by : ?eq:('key->'key-> bool)->?hash:('key-> int)->('a->'key)->('b->'key)->merge:('key->'a list->'b list->'c option)->'at->'bt->'ct
join_all_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and, for each key k occurring in at least one of them:
compute the list l1 of elements of a that map to k
compute the list l2 of elements of b that map to k
call merge k l1 l2. If merge returns None, the combination of values is discarded, otherwise it returns Some c and c is inserted in the result.
since
2.3
val group_join_by : ?eq:('a->'a-> bool)->?hash:('a-> int)->('b->'a)->'at->'bt->('a * 'b list)t
group_join_by ?eq ?hash key la lb associates to every element x of the first sequence, all the elements y of the second sequence such that eq x (key y). Elements of the first sequences without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x = hash y must hold.
since
2.3
val sublists_of_len : ?last:('a list->'a list option)->?offset:int->len:int->'a list->'a list list
sublists_of_len ?last ?offset n l returns sub-lists of l that have length n. By default, these sub-lists are non overlapping: sublists_of_len 2 [1;2;3;4;5;6] returns [1;2]; [3;4]; [5;6].
the number of elements skipped between two consecutive sub-lists. By default it is n. If offset < n, the sub-lists will overlap; if offset > n, some elements will not appear at all.
parameter last
if provided and the last group of elements g is such that length g < n, last g is called. If last g = Some g', g' is appended; otherwise g is dropped. If last = CCOpt.return, it will simply keep the last group. By default, last = fun _ -> None, i.e. the last group is dropped if shorter than n.
chunks n l returns consecutives chunks of size at most n from l. Each item of l will occur in exactly one chunk. Only the last chunk might be of length smaller than n. Invariant: (chunks n l |> List.flatten) = l.
since
3.2
val intersperse : x:'a->'a list->'a list
intersperse ~x l inserts the element x between adjacent elements of the list l.
since
2.1, but only
since
2.2 with labels
val interleave : 'a list->'a list->'a list
interleave [x1…xn] [y1…ym] is [x1,y1,x2,y2,…] and finishes with the suffix of the longest list.
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.
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 sn 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').
unlines_iter iter concatenates all strings of iter, separated with '\n'.
since
NEXT_RELEASE
val unlines_seq : string Stdlib.Seq.t-> string
unlines_seq seq concatenates all strings of seq, separated with '\n'.
since
NEXT_RELEASE
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.
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 stringss1 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).
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.
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 sn 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').
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.
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 stringss1 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).
\ No newline at end of file
diff --git a/dev/containers/CCStringLabels/index.html b/dev/containers/CCStringLabels/index.html
index e5725334..4f90537e 100644
--- a/dev/containers/CCStringLabels/index.html
+++ b/dev/containers/CCStringLabels/index.html
@@ -1,2 +1,2 @@
-CCStringLabels (containers.CCStringLabels)
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.
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 sn 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').
unlines_iter iter concatenates all strings of iter, separated with '\n'.
since
NEXT_RELEASE
val unlines_seq : string Stdlib.Seq.t-> string
unlines_seq seq concatenates all strings of seq, separated with '\n'.
since
NEXT_RELEASE
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.
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 stringss1 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).
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.
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 sn 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').
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.
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 stringss1 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).
\ No newline at end of file
diff --git a/dev/containers/CCUtf8_string/index.html b/dev/containers/CCUtf8_string/index.html
index b4c97128..e7b3a7a5 100644
--- a/dev/containers/CCUtf8_string/index.html
+++ b/dev/containers/CCUtf8_string/index.html
@@ -1,2 +1,2 @@
-CCUtf8_string (containers.CCUtf8_string)
Translate the unicode codepoint to a list of utf-8 bytes. This can be used, for example, in combination with Buffer.add_char on a pre-allocated buffer to add the bytes one by one (despite its name, Buffer.add_char takes individual bytes, not unicode codepoints).
Conversion from a string without validating. CAUTION this is unsafe and can break all the other functions in this module. Use only if you're sure the string is valid UTF8. Upon iteration, if an invalid substring is met, Malformed will be raised.
\ No newline at end of file
+CCUtf8_string (containers.CCUtf8_string)
Translate the unicode codepoint to a list of utf-8 bytes. This can be used, for example, in combination with Buffer.add_char on a pre-allocated buffer to add the bytes one by one (despite its name, Buffer.add_char takes individual bytes, not unicode codepoints).
Conversion from a string without validating. CAUTION this is unsafe and can break all the other functions in this module. Use only if you're sure the string is valid UTF8. Upon iteration, if an invalid substring is met, Malformed will be raised.
\ No newline at end of file
diff --git a/dev/index.html b/dev/index.html
index e732d532..c0e93dbc 100644
--- a/dev/index.html
+++ b/dev/index.html
@@ -11,9 +11,9 @@