From 93be8b2cd85b53143922ac8c4b077bd46859d47a Mon Sep 17 00:00:00 2001 From: Fardale Date: Thu, 5 Mar 2020 23:46:48 +0100 Subject: [PATCH] fix *Labels.mli for ocaml <= 4.04 --- src/core/CCArrayLabels.mli | 16 ++++++++++++++++ src/core/CCListLabels.mli | 4 ++++ src/core/CCStringLabels.mli | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/core/CCArrayLabels.mli b/src/core/CCArrayLabels.mli index dc0b104b..40317052 100644 --- a/src/core/CCArrayLabels.mli +++ b/src/core/CCArrayLabels.mli @@ -224,6 +224,13 @@ val fold2 : f:('acc -> 'a -> 'b -> 'acc) -> init:'acc -> 'a t -> 'b t -> 'acc @raise 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); ()]. + + @raise 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. *) @@ -283,6 +290,15 @@ val map : f:('a -> 'b) -> 'a t -> 'b t and builds an array with the results returned by [~f]: [[| ~f a.(0); ~f a.(1); ...; ~f a.(length a - 1) |]]. *) +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)|]]. + + @raise 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 *) diff --git a/src/core/CCListLabels.mli b/src/core/CCListLabels.mli index a48b0b40..7152ffa6 100644 --- a/src/core/CCListLabels.mli +++ b/src/core/CCListLabels.mli @@ -35,6 +35,10 @@ val (>|=) : 'a t -> ('a -> 'b) -> 'b t (** 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 (** Safe version of {!List.append}. Concatenate two lists. *) diff --git a/src/core/CCStringLabels.mli b/src/core/CCStringLabels.mli index a4dce45a..993aafd3 100644 --- a/src/core/CCStringLabels.mli +++ b/src/core/CCStringLabels.mli @@ -79,6 +79,9 @@ end include module type of struct include StringLabels end +val equal : string -> string -> bool +(** Equality function on strings. *) + val compare : string -> string -> int val is_empty : string -> bool @@ -314,6 +317,22 @@ val exists2 : f:(char -> char -> bool) -> string -> string -> bool 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 +(** See {!String}. + @since 0.18 *) + +val uncapitalize_ascii : string -> string +(** See {!String}. + @since 0.18 *) + +val uppercase_ascii : string -> string +(** See {!String}. + @since 0.18 *) + +val lowercase_ascii : string -> string +(** See {!String}. + @since 0.18 *) + val equal_caseless : string -> string -> bool (** Comparison without respect to {b ascii} lowercase. @since 1.2 *)