diff --git a/dev/containers/CCArray/index.html b/dev/containers/CCArray/index.html index 010205c4..a074e100 100644 --- a/dev/containers/CCArray/index.html +++ b/dev/containers/CCArray/index.html @@ -1,5 +1,5 @@ -
CCArrayArray utils
module Floatarray : sig ... endval empty : 'a tempty is the empty array, physically equal to [||].
equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.
compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.
val swap : 'a t -> int -> int -> unitswap a i j swaps elements at indices i and j.
val get_safe : 'a t -> int -> 'a optionget_safe a i returns Some a.(i) if i is a valid index.
val map_inplace : ( 'a -> 'a ) -> 'a t -> unitmap_inplace f a replace all elements of a by its image by f.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'afold f init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as Array.fold_left
val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'afoldi f init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.
val fold_while : ( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> 'a -> 'b t -> 'afold_while f init a folds left on array a until a stop condition via ('a, `Stop) is indicated by the accumulator.
fold_map f init a is a fold_left-like function, but it also maps the array to another array.
scan_left f init a returns the array [|init; f init x0; f (f init a.(0)) a.(1); …|] .
val reverse_in_place : 'a t -> unitreverse_in_place a reverses the array a in place.
val sorted : ( 'a -> 'a -> int ) -> 'a t -> 'a arraysorted f a makes a copy of a and sorts it with f.
val sort_indices : ( 'a -> 'a -> int ) -> 'a t -> int arraysort_indices f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of sorted f a appears in a. a is not modified.
In other words, map (fun i -> a.(i)) (sort_indices f a) = sorted f a. sort_indices yields the inverse permutation of sort_ranking.
val sort_ranking : ( 'a -> 'a -> int ) -> 'a t -> int arraysort_ranking f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of a appears in sorted f a. a is not modified.
In other words, map (fun i -> (sorted f a).(i)) (sort_ranking f a) = a. sort_ranking yields the inverse permutation of sort_indices.
In the absence of duplicate elements in a, we also have lookup_exn a.(i) (sorted a) = (sorted_ranking a).(i).
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> boolmem ~eq x a return true if x is present in a. Linear time.
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b optionfind_map f a returns Some y if there is an element x such that f x = Some y. Otherwise returns None.
val find_map_i : ( int -> 'a -> 'b option ) -> 'a t -> 'b optionfind_map_i f a is like find_map, but the index of the element is also passed to the predicate function f.
val find_idx : ( 'a -> bool ) -> 'a t -> (int * 'a) optionfind_idx f a returns Some (i,x) where x is the i-th element of a, and f x holds. Otherwise returns None.
lookup ~cmp key a lookups the index of some key key in a sorted array a. Undefined behavior if the array a is not sorted wrt ~cmp. Complexity: O(log (n)) (dichotomic search).
val bsearch :
+CCArray (containers.CCArray) Module CCArray
Array utils
Arrays
module Floatarray : sig ... endval empty : 'a tempty is the empty array, physically equal to [||].
equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.
compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.
val swap : 'a t -> int -> int -> unitswap a i j swaps elements at indices i and j.
val get_safe : 'a t -> int -> 'a optionget_safe a i returns Some a.(i) if i is a valid index.
val map_inplace : ( 'a -> 'a ) -> 'a t -> unitmap_inplace f a replace all elements of a by its image by f.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'afold f init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as Array.fold_left
val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'afoldi f init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.
val fold_while : ( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> 'a -> 'b t -> 'afold_while f init a folds left on array a until a stop condition via ('a, `Stop) is indicated by the accumulator.
fold_map f init a is a fold_left-like function, but it also maps the array to another array.
scan_left f init a returns the array [|init; f init x0; f (f init a.(0)) a.(1); …|] .
val reverse_in_place : 'a t -> unitreverse_in_place a reverses the array a in place.
val sorted : ( 'a -> 'a -> int ) -> 'a t -> 'a arraysorted f a makes a copy of a and sorts it with f.
val sort_indices : ( 'a -> 'a -> int ) -> 'a t -> int arraysort_indices f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of sorted f a appears in a. a is not modified.
In other words, map (fun i -> a.(i)) (sort_indices f a) = sorted f a. sort_indices yields the inverse permutation of sort_ranking.
val sort_ranking : ( 'a -> 'a -> int ) -> 'a t -> int arraysort_ranking f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of a appears in sorted f a. a is not modified.
In other words, map (fun i -> (sorted f a).(i)) (sort_ranking f a) = a. sort_ranking yields the inverse permutation of sort_indices.
In the absence of duplicate elements in a, we also have lookup_exn a.(i) (sorted a) = (sorted_ranking a).(i).
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> boolmem ~eq x a return true if x is present in a. Linear time.
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b optionfind_map f a returns Some y if there is an element x such that f x = Some y. Otherwise returns None.
val find_map_i : ( int -> 'a -> 'b option ) -> 'a t -> 'b optionfind_map_i f a is like find_map, but the index of the element is also passed to the predicate function f.
val find_idx : ( 'a -> bool ) -> 'a t -> (int * 'a) optionfind_idx f a returns Some (i,x) where x is the i-th element of a, and f x holds. Otherwise returns None.
lookup ~cmp key a lookups the index of some key key in a sorted array a. Undefined behavior if the array a is not sorted wrt ~cmp. Complexity: O(log (n)) (dichotomic search).
val bsearch :
cmp:( 'a -> 'a -> int ) ->
'a ->
'a t ->
diff --git a/dev/containers/CCArrayLabels/index.html b/dev/containers/CCArrayLabels/index.html
index 9b24a8d5..ce3623b6 100644
--- a/dev/containers/CCArrayLabels/index.html
+++ b/dev/containers/CCArrayLabels/index.html
@@ -9,7 +9,7 @@
f:( 'a -> 'b -> 'a * 'c ) ->
init:'a ->
'b array ->
- 'a * 'c arraymodule Floatarray : sig ... endval empty : 'a tempty is the empty array, physically equal to [||].
equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.
compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.
val swap : 'a t -> int -> int -> unitswap a i j swaps elements at indices i and j.
val get_safe : 'a t -> int -> 'a optionget_safe a i returns Some a.(i) if i is a valid index.
val map_inplace : f:( 'a -> 'a ) -> 'a t -> unitmap_inplace ~f a replace all elements of a by its image by f.
val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'afold ~f ~init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as ArrayLabels.fold_left
val foldi : f:( 'a -> int -> 'b -> 'a ) -> init:'a -> 'b t -> 'afoldi ~f ~init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.
module Floatarray : sig ... endval empty : 'a tempty is the empty array, physically equal to [||].
equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.
compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.
val swap : 'a t -> int -> int -> unitswap a i j swaps elements at indices i and j.
val get_safe : 'a t -> int -> 'a optionget_safe a i returns Some a.(i) if i is a valid index.
val map_inplace : f:( 'a -> 'a ) -> 'a t -> unitmap_inplace ~f a replace all elements of a by its image by f.
val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'afold ~f ~init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as ArrayLabels.fold_left
val foldi : f:( 'a -> int -> 'b -> 'a ) -> init:'a -> 'b t -> 'afoldi ~f ~init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.
val fold_while :
f:( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) ->
init:'a ->
'b t ->
diff --git a/dev/containers/CCSeq/index.html b/dev/containers/CCSeq/index.html
index 8c9d5d05..37edb9e8 100644
--- a/dev/containers/CCSeq/index.html
+++ b/dev/containers/CCSeq/index.html
@@ -1,5 +1,5 @@
-CCSeq (containers.CCSeq) Module CCSeq
Helpers for the standard Seq type
See oseq for a richer API.
Basics
type +'a t = unit -> 'a nodeval nil : 'a tval empty : 'a tval singleton : 'a -> 'a tval repeat : ?n:int -> 'a -> 'a trepeat ~n x repeats x n times then stops. If n is omitted, then x is repeated forever.
val unfold : ( 'b -> ('a * 'b) option ) -> 'b -> 'a tunfold f acc calls f acc and:
- if
f acc = Some (x, acc'), yield x, continue with unfold f acc'. - if
f acc = None, stops.
val is_empty : 'a t -> boolval head : 'a t -> 'a optionHead of the list.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'aFold on values.
val iter : ( 'a -> unit ) -> 'a t -> unitval iteri : ( int -> 'a -> unit ) -> 'a t -> unitIterate with index (starts at 0).
val length : _ t -> intNumber of elements in the list. Will not terminate if the list if infinite: use (for instance) take to make the list finite if necessary.
Fair product of two (possibly infinite) lists into a new list. Lazy. The first parameter is used to combine each pair of elements.
Specialization of product_with producing tuples.
group eq l groups together consecutive elements that satisfy eq. Lazy. For instance group (=) [1;1;1;2;2;3;3;1] yields [1;1;1]; [2;2]; [3;3]; [1].
uniq eq l returns l but removes consecutive duplicates. Lazy. In other words, if several values that are equal follow one another, only the first of them is kept.
val for_all : ( 'a -> bool ) -> 'a t -> boolfor_all p [a1; ...; an] checks if all elements of the sequence satisfy the predicate p. That is, it returns (p a1) && ... && (p an) for a non-empty list and true if the sequence is empty. It consumes the sequence until it finds an element not satisfying the predicate.
val exists : ( 'a -> bool ) -> 'a t -> boolexists p [a1; ...; an] checks if at least one element of the sequence satisfies the predicate p. That is, it returns (p a1) || ... || (p an) for a non-empty sequence and false if the list is empty. It consumes the sequence until it finds an element satisfying the predicate.
val range : int -> int -> int tval (--) : int -> int -> int ta -- b is the range of integers containing a and b (therefore, never empty).
val (--^) : int -> int -> int ta -- b is the integer range from a to b, where b is excluded.
Operations on two Collections
Fold on two collections at once. Stop at soon as one of them ends.
Map on two collections at once. Stop as soon as one of the arguments is exhausted.
Iterate on two collections at once. Stop as soon as one of them ends.
Combine elements pairwise. Stop as soon as one of the lists stops.
Misc
Eager sort. Require the iterator to be finite. O(n ln(n)) time and space.
Eager sort that removes duplicate values. Require the iterator to be finite. O(n ln(n)) time and space.
Fair Combinations
Implementations
val return : 'a -> 'a tval pure : 'a -> 'a tInfix version of fair_flat_map.
Infix operators
module Infix : sig ... endmodule type MONAD = sig ... endConversions
val of_list : 'a list -> 'a tval to_list : 'a t -> 'a listGather all values into a list.
val of_array : 'a array -> 'a tIterate on the array.
val to_array : 'a t -> 'a arrayConvert into array.
val of_string : string -> char tIterate on characters.
IO
val pp :
+CCSeq (containers.CCSeq) Module CCSeq
Helpers for the standard Seq type
See oseq for a richer API.
Basics
type +'a t = unit -> 'a nodeval nil : 'a tval empty : 'a tval singleton : 'a -> 'a tval repeat : ?n:int -> 'a -> 'a trepeat ~n x repeats x n times then stops. If n is omitted, then x is repeated forever.
val unfold : ( 'b -> ('a * 'b) option ) -> 'b -> 'a tunfold f acc calls f acc and:
- if
f acc = Some (x, acc'), yield x, continue with unfold f acc'. - if
f acc = None, stops.
val is_empty : 'a t -> boolval head : 'a t -> 'a optionHead of the list.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'aFold on values.
val iter : ( 'a -> unit ) -> 'a t -> unitval iteri : ( int -> 'a -> unit ) -> 'a t -> unitIterate with index (starts at 0).
val length : _ t -> intNumber of elements in the list. Will not terminate if the list if infinite: use (for instance) take to make the list finite if necessary.
Fair product of two (possibly infinite) lists into a new list. Lazy. The first parameter is used to combine each pair of elements.
Specialization of product_with producing tuples.
group eq l groups together consecutive elements that satisfy eq. Lazy. For instance group (=) [1;1;1;2;2;3;3;1] yields [1;1;1]; [2;2]; [3;3]; [1].
uniq eq l returns l but removes consecutive duplicates. Lazy. In other words, if several values that are equal follow one another, only the first of them is kept.
val for_all : ( 'a -> bool ) -> 'a t -> boolfor_all p [a1; ...; an] checks if all elements of the sequence satisfy the predicate p. That is, it returns (p a1) && ... && (p an) for a non-empty list and true if the sequence is empty. It consumes the sequence until it finds an element not satisfying the predicate.
val exists : ( 'a -> bool ) -> 'a t -> boolexists p [a1; ...; an] checks if at least one element of the sequence satisfies the predicate p. That is, it returns (p a1) || ... || (p an) for a non-empty sequence and false if the list is empty. It consumes the sequence until it finds an element satisfying the predicate.
val range : int -> int -> int tval (--) : int -> int -> int ta -- b is the range of integers containing a and b (therefore, never empty).
val (--^) : int -> int -> int ta -- b is the integer range from a to b, where b is excluded.
Operations on two Collections
Fold on two collections at once. Stop at soon as one of them ends.
Map on two collections at once. Stop as soon as one of the arguments is exhausted.
Iterate on two collections at once. Stop as soon as one of them ends.
Combine elements pairwise. Stop as soon as one of the lists stops.
Misc
Eager sort. Require the iterator to be finite. O(n ln(n)) time and space.
Eager sort that removes duplicate values. Require the iterator to be finite. O(n ln(n)) time and space.
Fair Combinations
Implementations
val return : 'a -> 'a tval pure : 'a -> 'a tInfix version of fair_flat_map.
Infix operators
module Infix : sig ... endmodule type MONAD = sig ... endConversions
val of_list : 'a list -> 'a tval to_list : 'a t -> 'a listGather all values into a list.
val of_array : 'a array -> 'a tIterate on the array.
val to_array : 'a t -> 'a arrayConvert into array.
val of_string : string -> char tIterate on characters.
IO
val pp :
?pp_start:unit printer ->
?pp_stop:unit printer ->
?pp_sep:unit printer ->
diff --git a/dev/containers/CCString/index.html b/dev/containers/CCString/index.html
index 26a2ef2f..a7dcfe6c 100644
--- a/dev/containers/CCString/index.html
+++ b/dev/containers/CCString/index.html
@@ -4,4 +4,4 @@
sub:string ->
by:string ->
string ->
- stringreplace ~which ~sub ~by s replaces some occurrences of sub by by in s.
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.
chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.
chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.
val lines_gen : string -> string genlines_gen s returns the gen of the lines of s (splits along '\n').
val lines_iter : string -> string iterlines_iter s returns the iter of the lines of s (splits along '\n').
lines_seq s returns the Seq.t of the lines of s (splits along '\n').
val concat_gen : sep:string -> string gen -> stringconcat_gen ~sep gen concatenates all strings of gen, separated with sep.
concat_seq ~sep seq concatenates all strings of seq, separated with sep.
val concat_iter : sep:string -> string iter -> stringconcat_iter ~sep iter concatenates all strings of iter, separated with sep.
val unlines_gen : string gen -> stringunlines_gen gen concatenates all strings of gen, separated with '\n'.
val unlines_iter : string iter -> stringunlines_iter iter concatenates all strings of iter, separated with '\n'.
unlines_seq seq concatenates all strings of seq, separated with '\n'.
set s i c creates a new string which is a copy of s, except for index i, which becomes c.
iter f s applies function f on each character of s. Alias to String.iter.
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).
filter f s discards characters of s not satisfying f.
uniq eq s remove consecutive duplicate characters in s.
flat_map ~sep f s maps each chars of s to a string, then concatenates them all.
for_all f s is true iff all characters of s satisfy the predicate f.
exists f s is true iff some character of s satisfy the predicate f.
drop_while f s discards any characters of s starting from the left, up to the first character c not satisfying f c.
rdrop_while f s discards any characters of s starting from the right, up to the first character c not satisfying f c.
Operations on 2 strings
iter2 f s1 s2 iterates on pairs of chars.
iteri2 f s1 s2 iterates on pairs of chars with their index.
fold2 f init s1 s2 folds on pairs of chars.
for_all2 f s1 s2 returns true iff all pairs of chars satisfy the predicate f.
exists2 f s1 s2 returns true iff a pair of chars satisfy the predicate f.
Ascii functions
Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.
equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.
Same as of_hex but fails harder.
Finding
A relatively efficient algorithm for finding sub-strings.
module Find : sig ... endSplitting
module Split : sig ... endsplit_on_char by s splits the string s along the given char by.
split ~by s splits the string s along the given string by. Alias to Split.list_cpy.
Utils
compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.
compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order
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.
Infix operators
module Infix : sig ... end
\ No newline at end of file
+ stringreplace ~which ~sub ~by s replaces some occurrences of sub by by in s.
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.
chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.
chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.
val lines_gen : string -> string genlines_gen s returns the gen of the lines of s (splits along '\n').
val lines_iter : string -> string iterlines_iter s returns the iter of the lines of s (splits along '\n').
lines_seq s returns the Seq.t of the lines of s (splits along '\n').
val concat_gen : sep:string -> string gen -> stringconcat_gen ~sep gen concatenates all strings of gen, separated with sep.
concat_seq ~sep seq concatenates all strings of seq, separated with sep.
val concat_iter : sep:string -> string iter -> stringconcat_iter ~sep iter concatenates all strings of iter, separated with sep.
val unlines_gen : string gen -> stringunlines_gen gen concatenates all strings of gen, separated with '\n'.
val unlines_iter : string iter -> stringunlines_iter iter concatenates all strings of iter, separated with '\n'.
unlines_seq seq concatenates all strings of seq, separated with '\n'.
set s i c creates a new string which is a copy of s, except for index i, which becomes c.
iter f s applies function f on each character of s. Alias to String.iter.
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).
filter f s discards characters of s not satisfying f.
uniq eq s remove consecutive duplicate characters in s.
flat_map ~sep f s maps each chars of s to a string, then concatenates them all.
for_all f s is true iff all characters of s satisfy the predicate f.
exists f s is true iff some character of s satisfy the predicate f.
drop_while f s discards any characters of s starting from the left, up to the first character c not satisfying f c.
rdrop_while f s discards any characters of s starting from the right, up to the first character c not satisfying f c.
Operations on 2 strings
iter2 f s1 s2 iterates on pairs of chars.
iteri2 f s1 s2 iterates on pairs of chars with their index.
fold2 f init s1 s2 folds on pairs of chars.
for_all2 f s1 s2 returns true iff all pairs of chars satisfy the predicate f.
exists2 f s1 s2 returns true iff a pair of chars satisfy the predicate f.
Ascii functions
Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.
equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.
Same as of_hex but fails harder.
Finding
A relatively efficient algorithm for finding sub-strings.
module Find : sig ... endSplitting
module Split : sig ... endsplit_on_char by s splits the string s along the given char by.
split ~by s splits the string s along the given string by. Alias to Split.list_cpy.
Utils
compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.
compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order
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.
Infix operators
module Infix : sig ... end
\ No newline at end of file
diff --git a/dev/containers/CCStringLabels/index.html b/dev/containers/CCStringLabels/index.html
index 12b9fcf8..05d10ed8 100644
--- a/dev/containers/CCStringLabels/index.html
+++ b/dev/containers/CCStringLabels/index.html
@@ -22,4 +22,4 @@
string ->
pos:int ->
sub_len:int ->
- boolis_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.
chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.
chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.
val lines_gen : string -> string genlines_gen s returns a generator gen of the lines of s (splits along '\n').
val lines_iter : string -> string iterlines_iter s returns the iter of the lines of s (splits along '\n').
lines_seq s returns the Seq.t of the lines of s (splits along '\n').
val concat_iter : sep:string -> string iter -> stringconcat_iter ~sep iter concatenates all strings of iter, separated with sep.
val concat_gen : sep:string -> string gen -> stringconcat_gen ~sep gen concatenates all strings of gen, separated with sep.
concat_seq ~sep seq concatenates all strings of seq, separated with sep.
val unlines_gen : string gen -> stringunlines_gen gen concatenates all strings of gen, separated with '\n'.
val unlines_iter : string iter -> stringunlines_iter iter concatenates all strings of iter, separated with '\n'.
unlines_seq seq concatenates all strings of seq, separated with '\n'.
set s i c creates a new string which is a copy of s, except for index i, which becomes c.
iter ~f s applies function f on each character of s. Alias to String.iter.
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).
filter ~f s discards characters of s not satisfying f.
uniq ~eq s remove consecutive duplicate characters in s.
flat_map ?sep ~f s maps each chars of s to a string, then concatenates them all.
for_all ~f s is true iff all characters of s satisfy the predicate f.
exists ~f s is true iff some character of s satisfy the predicate f.
drop_while ~f s discards any characters of s starting from the left, up to the first character c not satisfying f c.
rdrop_while ~f s discards any characters of s starting from the right, up to the first character c not satisfying f c.
map2 ~f s1 s2 maps pairs of chars.
iter2 ~f s1 s2 iterates on pairs of chars.
iteri2 ~f s1 s2 iterates on pairs of chars with their index.
fold2 ~f ~init s1 s2 folds on pairs of chars.
for_all2 ~f s1 s2 returns true iff all pairs of chars satisfy the predicate f.
exists2 ~f s1 s2 returns true iff a pair of chars satisfy the predicate f.
Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.
capitalize_ascii s returns a copy of s with the first character set to uppercase using the US-ASCII character set. See String.
uncapitalize_ascii s returns a copy of s with the first character set to lowercase using the US-ASCII character set. See String.
uppercase_ascii s returns a copy of s with all lowercase letters translated to uppercase using the US-ASCII character set. See String.
lowercase_ascii s returns a copy of s with all uppercase letters translated to lowercase using the US-ASCII character set. See String.
equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.
Same as of_hex but fails harder.
A relatively efficient algorithm for finding sub-strings.
module Find : sig ... endmodule Split : sig ... endsplit_on_char ~by s splits the string s along the given char by.
split ~by s splits the string s along the given string by. Alias to Split.list_cpy.
compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.
compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order
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.
module Infix : sig ... endis_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.
chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.
chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.
val lines_gen : string -> string genlines_gen s returns a generator gen of the lines of s (splits along '\n').
val lines_iter : string -> string iterlines_iter s returns the iter of the lines of s (splits along '\n').
lines_seq s returns the Seq.t of the lines of s (splits along '\n').
val concat_iter : sep:string -> string iter -> stringconcat_iter ~sep iter concatenates all strings of iter, separated with sep.
val concat_gen : sep:string -> string gen -> stringconcat_gen ~sep gen concatenates all strings of gen, separated with sep.
concat_seq ~sep seq concatenates all strings of seq, separated with sep.
val unlines_gen : string gen -> stringunlines_gen gen concatenates all strings of gen, separated with '\n'.
val unlines_iter : string iter -> stringunlines_iter iter concatenates all strings of iter, separated with '\n'.
unlines_seq seq concatenates all strings of seq, separated with '\n'.
set s i c creates a new string which is a copy of s, except for index i, which becomes c.
iter ~f s applies function f on each character of s. Alias to String.iter.
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).
filter ~f s discards characters of s not satisfying f.
uniq ~eq s remove consecutive duplicate characters in s.
flat_map ?sep ~f s maps each chars of s to a string, then concatenates them all.
for_all ~f s is true iff all characters of s satisfy the predicate f.
exists ~f s is true iff some character of s satisfy the predicate f.
drop_while ~f s discards any characters of s starting from the left, up to the first character c not satisfying f c.
rdrop_while ~f s discards any characters of s starting from the right, up to the first character c not satisfying f c.
map2 ~f s1 s2 maps pairs of chars.
iter2 ~f s1 s2 iterates on pairs of chars.
iteri2 ~f s1 s2 iterates on pairs of chars with their index.
fold2 ~f ~init s1 s2 folds on pairs of chars.
for_all2 ~f s1 s2 returns true iff all pairs of chars satisfy the predicate f.
exists2 ~f s1 s2 returns true iff a pair of chars satisfy the predicate f.
Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.
capitalize_ascii s returns a copy of s with the first character set to uppercase using the US-ASCII character set. See String.
uncapitalize_ascii s returns a copy of s with the first character set to lowercase using the US-ASCII character set. See String.
uppercase_ascii s returns a copy of s with all lowercase letters translated to uppercase using the US-ASCII character set. See String.
lowercase_ascii s returns a copy of s with all uppercase letters translated to lowercase using the US-ASCII character set. See String.
equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.
Same as of_hex but fails harder.
A relatively efficient algorithm for finding sub-strings.
module Find : sig ... endmodule Split : sig ... endsplit_on_char ~by s splits the string s along the given char by.
split ~by s splits the string s along the given string by. Alias to Split.list_cpy.
compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.
compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order
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.
module Infix : sig ... endContainers_bencodeBasic Bencode decoder/encoder.
See https://en.wikipedia.org/wiki/Bencode .
module Str_map : sig ... endval hash : t -> intval pp_debug : Stdlib.Format.formatter -> t -> unitPrinter for diagnostic/human consumption
val to_string_debug : t -> stringval int : int -> tval int64 : int64 -> tval string : string -> tmodule Encode : sig ... endEncoding
module Decode : sig ... endDecoding
Containers_bencodeBasic Bencode decoder/encoder.
See https://en.wikipedia.org/wiki/Bencode .
module Str_map : sig ... endval hash : t -> intval pp_debug : Stdlib.Format.formatter -> t -> unitPrinter for diagnostic/human consumption
val to_string_debug : t -> stringval int : int -> tval int64 : int64 -> tval string : string -> tmodule Encode : sig ... endEncoding
module Decode : sig ... endDecoding