From 18c9f8841170b4b60f598786917423f91a717800 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 2 Jan 2018 18:14:32 +0100 Subject: [PATCH] prepare for 1.5 --- CHANGELOG.adoc | 22 ++++++++++++++++++++++ _oasis | 2 +- src/core/CCHash.mli | 2 +- src/core/CCList.mli | 14 +++++++------- src/core/CCListLabels.mli | 2 +- src/core/CCMap.ml | 12 ++++++------ src/core/CCMap.mli | 14 +++++++------- src/core/CCResult.mli | 2 +- src/core/CCSet.ml | 16 ++++++++-------- src/core/CCSet.mli | 18 +++++++++--------- src/core/CCString.mli | 6 +++--- src/data/CCCache.mli | 2 +- src/data/CCImmutArray.mli | 2 +- 13 files changed, 68 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index badb978e..ee38ca6d 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -1,5 +1,27 @@ = Changelog +== 1.5 + +- have `CCList.{get,insert,set}_at_idx` work with negative indices +- Add CCCache.add +- missing function in `CCListLabels` +- Allow negative indexes in CCList.remove_at_idx +- add an optional `drop` parameter to string-splitting functions +- add `Hash.const0` for trivial hash function that ignores its input +- improve compatibility with the stdlib +- Add List.count +- Add String.is_empty +- add missing compatibility functions: `{assoc_opt,assq_opt}` +- backport some functions added in 4.05 in `CCList` +- add functions from 4.05 into `CC{Map,Set}` +- Implement `CCImmutArray.sub` +- bugfix in `CCTrie.Make`: Remove polymorphic comparison + +- remove dependency on cppo +- add travis support +- update doc of `CCList.cartesian_product`, which returns results in unspecified order (close #154) +- fix containers.top (closes #155) + == 1.4 - add `CCMap.union` diff --git a/_oasis b/_oasis index 99dfa6f1..6b9db690 100644 --- a/_oasis +++ b/_oasis @@ -1,6 +1,6 @@ OASISFormat: 0.4 Name: containers -Version: 1.4 +Version: 1.5 Homepage: https://github.com/c-cube/ocaml-containers Authors: Simon Cruanes License: BSD-2-clause diff --git a/src/core/CCHash.mli b/src/core/CCHash.mli index e370934b..ca7b4956 100644 --- a/src/core/CCHash.mli +++ b/src/core/CCHash.mli @@ -18,7 +18,7 @@ val const0 : _ t (** Always return 0. Useful for ignoring elements. Example: [Hash.(pair string const0)] will map pairs [("a", 1)] and [("a", 2)] to the same hash, but not the same as [("b", 1)] - @since NEXT_RELEASE *) + @since 1.5 *) val int : int t val bool : bool t diff --git a/src/core/CCList.mli b/src/core/CCList.mli index 4062c8d5..c6fe1af1 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -78,7 +78,7 @@ val fold_flat_map : ('acc -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * val count : ('a -> bool) -> 'a list -> int (** [count f l] counts how much element of [l] comply with the function [f]. - @since NEXT_RELEASE *) + @since 1.5 *) val init : int -> (int -> 'a) -> 'a t (** Similar to {!Array.init} @@ -103,11 +103,11 @@ val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int val compare_lengths : 'a t -> 'b t -> int (** equivalent to [compare (length l1) (length l2)] but more efficient. - @since NEXT_RELEASE *) + @since 1.5 *) val compare_length_with : 'a t -> int -> int (** equivalent to [compare (length l) x] but more efficient. - @since NEXT_RELEASE *) + @since 1.5 *) val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool @@ -239,7 +239,7 @@ val find_pred : ('a -> bool) -> 'a t -> 'a option val find_opt : ('a -> bool) -> 'a t -> 'a option (** Safe version of {!find} - @since NEXT_RELEASE *) + @since 1.5 *) val find_pred_exn : ('a -> bool) -> 'a t -> 'a (** Unsafe version of {!find_pred} @@ -346,7 +346,7 @@ val get_at_idx : int -> 'a t -> 'a option val nth_opt : 'a t -> int -> 'a option (** Safe version of {!nth}. @raise Invalid_argument if the int is negative. - @since NEXT_RELEASE *) + @since 1.5 *) val get_at_idx_exn : int -> 'a t -> 'a (** Get the i-th element, or @@ -466,11 +466,11 @@ end val assoc_opt : 'a -> ('a * 'b) t -> 'b option (** Safe version of {!assoc} - @since NEXT_RELEASE *) + @since 1.5 *) val assq_opt : 'a -> ('a * 'b) t -> 'b option (** Safe version of {!assq} - @since NEXT_RELEASE *) + @since 1.5 *) (** {2 References on Lists} @since 0.3.3 *) diff --git a/src/core/CCListLabels.mli b/src/core/CCListLabels.mli index 535eab06..4bc67737 100644 --- a/src/core/CCListLabels.mli +++ b/src/core/CCListLabels.mli @@ -109,7 +109,7 @@ val sublists_of_len : See {!CCList.sublists_of_len} for more details. - @since NEXT_RELEASE *) + @since 1.5 *) val pure : 'a -> 'a t diff --git a/src/core/CCMap.ml b/src/core/CCMap.ml index 1ac3fd2c..d1342ed1 100644 --- a/src/core/CCMap.ml +++ b/src/core/CCMap.ml @@ -27,28 +27,28 @@ module type S = sig val choose_opt : 'a t -> (key * 'a) option (** Safe version of {!choose} - @since NEXT_RELEASE *) + @since 1.5 *) val min_binding_opt : 'a t -> (key * 'a) option (** Safe version of {!min_binding} - @since NEXT_RELEASE *) + @since 1.5 *) val max_binding_opt : 'a t -> (key * 'a) option (** Safe version of {!max_binding} - @since NEXT_RELEASE *) + @since 1.5 *) val find_opt : key -> 'a t -> 'a option (** Safe version of {!find} - @since NEXT_RELEASE *) + @since 1.5 *) val find_first : (key -> bool) -> 'a t -> key * 'a (** Find smallest binding satisfying the monotonic predicate. See {!Map.S.find_first}. - @since NEXT_RELEASE *) + @since 1.5 *) val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option (** Safe version of {!find_first} - @since NEXT_RELEASE *) + @since 1.5 *) val merge_safe : f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) -> diff --git a/src/core/CCMap.mli b/src/core/CCMap.mli index 12da1117..14b689e7 100644 --- a/src/core/CCMap.mli +++ b/src/core/CCMap.mli @@ -10,7 +10,7 @@ type 'a sequence = ('a -> unit) -> unit type 'a printer = Format.formatter -> 'a -> unit module type OrderedType = Map.OrderedType -(** @since NEXT_RELEASE *) +(** @since 1.5 *) module type S = sig include Map.S @@ -31,28 +31,28 @@ module type S = sig val choose_opt : 'a t -> (key * 'a) option (** Safe version of {!choose} - @since NEXT_RELEASE *) + @since 1.5 *) val min_binding_opt : 'a t -> (key * 'a) option (** Safe version of {!min_binding} - @since NEXT_RELEASE *) + @since 1.5 *) val max_binding_opt : 'a t -> (key * 'a) option (** Safe version of {!max_binding} - @since NEXT_RELEASE *) + @since 1.5 *) val find_opt : key -> 'a t -> 'a option (** Safe version of {!find} - @since NEXT_RELEASE *) + @since 1.5 *) val find_first : (key -> bool) -> 'a t -> key * 'a (** Find smallest binding satisfying the monotonic predicate. See {!Map.S.find_first}. - @since NEXT_RELEASE *) + @since 1.5 *) val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option (** Safe version of {!find_first} - @since NEXT_RELEASE *) + @since 1.5 *) val merge_safe : f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) -> diff --git a/src/core/CCResult.mli b/src/core/CCResult.mli index 8623ace6..a494081a 100644 --- a/src/core/CCResult.mli +++ b/src/core/CCResult.mli @@ -15,7 +15,7 @@ type 'a printer = Format.formatter -> 'a -> unit (** {2 Basics} *) include module type of Result -(** @since NEXT_RELEASE *) +(** @since 1.5 *) type (+'good, +'bad) t = ('good, 'bad) Result.result = | Ok of 'good diff --git a/src/core/CCSet.ml b/src/core/CCSet.ml index 6430d59b..32ae1a31 100644 --- a/src/core/CCSet.ml +++ b/src/core/CCSet.ml @@ -13,35 +13,35 @@ module type S = sig val min_elt_opt : t -> elt option (** Safe version of {!min_elt} - @since NEXT_RELEASE *) + @since 1.5 *) val max_elt_opt : t -> elt option (** Safe version of {!max_elt} - @since NEXT_RELEASE *) + @since 1.5 *) val choose_opt : t -> elt option (** Safe version of {!choose} - @since NEXT_RELEASE *) + @since 1.5 *) val find_opt : elt -> t -> elt option (** Safe version of {!find} - @since NEXT_RELEASE *) + @since 1.5 *) val find_first : (elt -> bool) -> t -> elt (** Find minimum element satisfying predicate - @since NEXT_RELEASE *) + @since 1.5 *) val find_first_opt : (elt -> bool) -> t -> elt option (** Safe version of {!find_first} - @since NEXT_RELEASE *) + @since 1.5 *) val find_last : (elt -> bool) -> t -> elt (** Find maximum element satisfying predicate - @since NEXT_RELEASE *) + @since 1.5 *) val find_last_opt : (elt -> bool) -> t -> elt option (** Safe version of {!find_last} - @since NEXT_RELEASE *) + @since 1.5 *) val of_seq : elt sequence -> t diff --git a/src/core/CCSet.mli b/src/core/CCSet.mli index e525b8d8..6eebbb93 100644 --- a/src/core/CCSet.mli +++ b/src/core/CCSet.mli @@ -9,42 +9,42 @@ type 'a sequence = ('a -> unit) -> unit type 'a printer = Format.formatter -> 'a -> unit module type OrderedType = Set.OrderedType -(** @since NEXT_RELEASE *) +(** @since 1.5 *) module type S = sig include Set.S val min_elt_opt : t -> elt option (** Safe version of {!min_elt} - @since NEXT_RELEASE *) + @since 1.5 *) val max_elt_opt : t -> elt option (** Safe version of {!max_elt} - @since NEXT_RELEASE *) + @since 1.5 *) val choose_opt : t -> elt option (** Safe version of {!choose} - @since NEXT_RELEASE *) + @since 1.5 *) val find_opt : elt -> t -> elt option (** Safe version of {!find} - @since NEXT_RELEASE *) + @since 1.5 *) val find_first : (elt -> bool) -> t -> elt (** Find minimum element satisfying predicate - @since NEXT_RELEASE *) + @since 1.5 *) val find_first_opt : (elt -> bool) -> t -> elt option (** Safe version of {!find_first} - @since NEXT_RELEASE *) + @since 1.5 *) val find_last : (elt -> bool) -> t -> elt (** Find maximum element satisfying predicate - @since NEXT_RELEASE *) + @since 1.5 *) val find_last_opt : (elt -> bool) -> t -> elt option (** Safe version of {!find_last} - @since NEXT_RELEASE *) + @since 1.5 *) val of_seq : elt sequence -> t diff --git a/src/core/CCString.mli b/src/core/CCString.mli index 7df41f5a..5852b3ae 100644 --- a/src/core/CCString.mli +++ b/src/core/CCString.mli @@ -55,7 +55,7 @@ val equal : string -> string -> bool val compare : string -> string -> int val is_empty : string -> bool -(** @since NEXT_RELEASE *) +(** @since 1.5 *) val hash : string -> int @@ -504,7 +504,7 @@ module Split : sig - [{first=true; last=true}] will return ["a"; "b"] The default value of all remaining functions is [Drop_none]. - @since NEXT_RELEASE + @since 1.5 *) type drop_if_empty = { first: bool; @@ -513,7 +513,7 @@ module Split : sig val no_drop : drop_if_empty (** Do not drop any group, even empty and on borders - @since NEXT_RELEASE *) + @since 1.5 *) val list_ : ?drop:drop_if_empty -> by:string -> string -> (string*int*int) list (** Eplit the given string along the given separator [by]. Should only diff --git a/src/data/CCCache.mli b/src/data/CCCache.mli index e689f090..28c287b2 100644 --- a/src/data/CCCache.mli +++ b/src/data/CCCache.mli @@ -74,7 +74,7 @@ val iter : ('a,'b) t -> ('a -> 'b -> unit) -> unit val add : ('a, 'b) t -> 'a -> 'b -> bool (** Manually add a cached value. Returns [true] if the value has succesfully been added, and [false] if the value was already bound. - @since NEXT_RELEASE *) + @since 1.5 *) val dummy : ('a,'b) t (** Dummy cache, never stores any value *) diff --git a/src/data/CCImmutArray.mli b/src/data/CCImmutArray.mli index a489fc38..a58dc35c 100644 --- a/src/data/CCImmutArray.mli +++ b/src/data/CCImmutArray.mli @@ -43,7 +43,7 @@ val sub : 'a t -> int -> int -> 'a t Raises [Invalid_argument "Array.sub"] if [start] and [len] do not designate a valid subarray of a; that is, if start < 0, or len < 0, or start + len > Array.length a. - @since NEXT_RELEASE *) + @since 1.5 *) val map : ('a -> 'b) -> 'a t -> 'b t