mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
prepare for 1.5
This commit is contained in:
parent
7f6cb0f673
commit
18c9f88411
13 changed files with 68 additions and 46 deletions
|
|
@ -1,5 +1,27 @@
|
||||||
= Changelog
|
= 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
|
== 1.4
|
||||||
|
|
||||||
- add `CCMap.union`
|
- add `CCMap.union`
|
||||||
|
|
|
||||||
2
_oasis
2
_oasis
|
|
@ -1,6 +1,6 @@
|
||||||
OASISFormat: 0.4
|
OASISFormat: 0.4
|
||||||
Name: containers
|
Name: containers
|
||||||
Version: 1.4
|
Version: 1.5
|
||||||
Homepage: https://github.com/c-cube/ocaml-containers
|
Homepage: https://github.com/c-cube/ocaml-containers
|
||||||
Authors: Simon Cruanes
|
Authors: Simon Cruanes
|
||||||
License: BSD-2-clause
|
License: BSD-2-clause
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ val const0 : _ t
|
||||||
(** Always return 0. Useful for ignoring elements.
|
(** Always return 0. Useful for ignoring elements.
|
||||||
Example: [Hash.(pair string const0)] will map pairs [("a", 1)]
|
Example: [Hash.(pair string const0)] will map pairs [("a", 1)]
|
||||||
and [("a", 2)] to the same hash, but not the same as [("b", 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 int : int t
|
||||||
val bool : bool t
|
val bool : bool t
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ val fold_flat_map : ('acc -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc *
|
||||||
|
|
||||||
val count : ('a -> bool) -> 'a list -> int
|
val count : ('a -> bool) -> 'a list -> int
|
||||||
(** [count f l] counts how much element of [l] comply with the function [f].
|
(** [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
|
val init : int -> (int -> 'a) -> 'a t
|
||||||
(** Similar to {!Array.init}
|
(** 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
|
val compare_lengths : 'a t -> 'b t -> int
|
||||||
(** equivalent to [compare (length l1) (length l2)] but more efficient.
|
(** equivalent to [compare (length l1) (length l2)] but more efficient.
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val compare_length_with : 'a t -> int -> int
|
val compare_length_with : 'a t -> int -> int
|
||||||
(** equivalent to [compare (length l) x] but more efficient.
|
(** 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
|
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
|
val find_opt : ('a -> bool) -> 'a t -> 'a option
|
||||||
(** Safe version of {!find}
|
(** Safe version of {!find}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_pred_exn : ('a -> bool) -> 'a t -> 'a
|
val find_pred_exn : ('a -> bool) -> 'a t -> 'a
|
||||||
(** Unsafe version of {!find_pred}
|
(** 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
|
val nth_opt : 'a t -> int -> 'a option
|
||||||
(** Safe version of {!nth}.
|
(** Safe version of {!nth}.
|
||||||
@raise Invalid_argument if the int is negative.
|
@raise Invalid_argument if the int is negative.
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val get_at_idx_exn : int -> 'a t -> 'a
|
val get_at_idx_exn : int -> 'a t -> 'a
|
||||||
(** Get the i-th element, or
|
(** Get the i-th element, or
|
||||||
|
|
@ -466,11 +466,11 @@ end
|
||||||
|
|
||||||
val assoc_opt : 'a -> ('a * 'b) t -> 'b option
|
val assoc_opt : 'a -> ('a * 'b) t -> 'b option
|
||||||
(** Safe version of {!assoc}
|
(** Safe version of {!assoc}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val assq_opt : 'a -> ('a * 'b) t -> 'b option
|
val assq_opt : 'a -> ('a * 'b) t -> 'b option
|
||||||
(** Safe version of {!assq}
|
(** Safe version of {!assq}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
(** {2 References on Lists}
|
(** {2 References on Lists}
|
||||||
@since 0.3.3 *)
|
@since 0.3.3 *)
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ val sublists_of_len :
|
||||||
|
|
||||||
See {!CCList.sublists_of_len} for more details.
|
See {!CCList.sublists_of_len} for more details.
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val pure : 'a -> 'a t
|
val pure : 'a -> 'a t
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,28 +27,28 @@ module type S = sig
|
||||||
|
|
||||||
val choose_opt : 'a t -> (key * 'a) option
|
val choose_opt : 'a t -> (key * 'a) option
|
||||||
(** Safe version of {!choose}
|
(** Safe version of {!choose}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val min_binding_opt : 'a t -> (key * 'a) option
|
val min_binding_opt : 'a t -> (key * 'a) option
|
||||||
(** Safe version of {!min_binding}
|
(** Safe version of {!min_binding}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val max_binding_opt : 'a t -> (key * 'a) option
|
val max_binding_opt : 'a t -> (key * 'a) option
|
||||||
(** Safe version of {!max_binding}
|
(** Safe version of {!max_binding}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_opt : key -> 'a t -> 'a option
|
val find_opt : key -> 'a t -> 'a option
|
||||||
(** Safe version of {!find}
|
(** Safe version of {!find}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_first : (key -> bool) -> 'a t -> key * 'a
|
val find_first : (key -> bool) -> 'a t -> key * 'a
|
||||||
(** Find smallest binding satisfying the monotonic predicate.
|
(** Find smallest binding satisfying the monotonic predicate.
|
||||||
See {!Map.S.find_first}.
|
See {!Map.S.find_first}.
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
|
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
|
||||||
(** Safe version of {!find_first}
|
(** Safe version of {!find_first}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val merge_safe :
|
val merge_safe :
|
||||||
f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) ->
|
f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) ->
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ type 'a sequence = ('a -> unit) -> unit
|
||||||
type 'a printer = Format.formatter -> 'a -> unit
|
type 'a printer = Format.formatter -> 'a -> unit
|
||||||
|
|
||||||
module type OrderedType = Map.OrderedType
|
module type OrderedType = Map.OrderedType
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 1.5 *)
|
||||||
|
|
||||||
module type S = sig
|
module type S = sig
|
||||||
include Map.S
|
include Map.S
|
||||||
|
|
@ -31,28 +31,28 @@ module type S = sig
|
||||||
|
|
||||||
val choose_opt : 'a t -> (key * 'a) option
|
val choose_opt : 'a t -> (key * 'a) option
|
||||||
(** Safe version of {!choose}
|
(** Safe version of {!choose}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val min_binding_opt : 'a t -> (key * 'a) option
|
val min_binding_opt : 'a t -> (key * 'a) option
|
||||||
(** Safe version of {!min_binding}
|
(** Safe version of {!min_binding}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val max_binding_opt : 'a t -> (key * 'a) option
|
val max_binding_opt : 'a t -> (key * 'a) option
|
||||||
(** Safe version of {!max_binding}
|
(** Safe version of {!max_binding}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_opt : key -> 'a t -> 'a option
|
val find_opt : key -> 'a t -> 'a option
|
||||||
(** Safe version of {!find}
|
(** Safe version of {!find}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_first : (key -> bool) -> 'a t -> key * 'a
|
val find_first : (key -> bool) -> 'a t -> key * 'a
|
||||||
(** Find smallest binding satisfying the monotonic predicate.
|
(** Find smallest binding satisfying the monotonic predicate.
|
||||||
See {!Map.S.find_first}.
|
See {!Map.S.find_first}.
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
|
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
|
||||||
(** Safe version of {!find_first}
|
(** Safe version of {!find_first}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val merge_safe :
|
val merge_safe :
|
||||||
f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) ->
|
f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) ->
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ type 'a printer = Format.formatter -> 'a -> unit
|
||||||
(** {2 Basics} *)
|
(** {2 Basics} *)
|
||||||
|
|
||||||
include module type of Result
|
include module type of Result
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 1.5 *)
|
||||||
|
|
||||||
type (+'good, +'bad) t = ('good, 'bad) Result.result =
|
type (+'good, +'bad) t = ('good, 'bad) Result.result =
|
||||||
| Ok of 'good
|
| Ok of 'good
|
||||||
|
|
|
||||||
|
|
@ -13,35 +13,35 @@ module type S = sig
|
||||||
|
|
||||||
val min_elt_opt : t -> elt option
|
val min_elt_opt : t -> elt option
|
||||||
(** Safe version of {!min_elt}
|
(** Safe version of {!min_elt}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val max_elt_opt : t -> elt option
|
val max_elt_opt : t -> elt option
|
||||||
(** Safe version of {!max_elt}
|
(** Safe version of {!max_elt}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val choose_opt : t -> elt option
|
val choose_opt : t -> elt option
|
||||||
(** Safe version of {!choose}
|
(** Safe version of {!choose}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_opt : elt -> t -> elt option
|
val find_opt : elt -> t -> elt option
|
||||||
(** Safe version of {!find}
|
(** Safe version of {!find}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_first : (elt -> bool) -> t -> elt
|
val find_first : (elt -> bool) -> t -> elt
|
||||||
(** Find minimum element satisfying predicate
|
(** Find minimum element satisfying predicate
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_first_opt : (elt -> bool) -> t -> elt option
|
val find_first_opt : (elt -> bool) -> t -> elt option
|
||||||
(** Safe version of {!find_first}
|
(** Safe version of {!find_first}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_last : (elt -> bool) -> t -> elt
|
val find_last : (elt -> bool) -> t -> elt
|
||||||
(** Find maximum element satisfying predicate
|
(** Find maximum element satisfying predicate
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_last_opt : (elt -> bool) -> t -> elt option
|
val find_last_opt : (elt -> bool) -> t -> elt option
|
||||||
(** Safe version of {!find_last}
|
(** Safe version of {!find_last}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val of_seq : elt sequence -> t
|
val of_seq : elt sequence -> t
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,42 +9,42 @@ type 'a sequence = ('a -> unit) -> unit
|
||||||
type 'a printer = Format.formatter -> 'a -> unit
|
type 'a printer = Format.formatter -> 'a -> unit
|
||||||
|
|
||||||
module type OrderedType = Set.OrderedType
|
module type OrderedType = Set.OrderedType
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 1.5 *)
|
||||||
|
|
||||||
module type S = sig
|
module type S = sig
|
||||||
include Set.S
|
include Set.S
|
||||||
|
|
||||||
val min_elt_opt : t -> elt option
|
val min_elt_opt : t -> elt option
|
||||||
(** Safe version of {!min_elt}
|
(** Safe version of {!min_elt}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val max_elt_opt : t -> elt option
|
val max_elt_opt : t -> elt option
|
||||||
(** Safe version of {!max_elt}
|
(** Safe version of {!max_elt}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val choose_opt : t -> elt option
|
val choose_opt : t -> elt option
|
||||||
(** Safe version of {!choose}
|
(** Safe version of {!choose}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_opt : elt -> t -> elt option
|
val find_opt : elt -> t -> elt option
|
||||||
(** Safe version of {!find}
|
(** Safe version of {!find}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_first : (elt -> bool) -> t -> elt
|
val find_first : (elt -> bool) -> t -> elt
|
||||||
(** Find minimum element satisfying predicate
|
(** Find minimum element satisfying predicate
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_first_opt : (elt -> bool) -> t -> elt option
|
val find_first_opt : (elt -> bool) -> t -> elt option
|
||||||
(** Safe version of {!find_first}
|
(** Safe version of {!find_first}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_last : (elt -> bool) -> t -> elt
|
val find_last : (elt -> bool) -> t -> elt
|
||||||
(** Find maximum element satisfying predicate
|
(** Find maximum element satisfying predicate
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val find_last_opt : (elt -> bool) -> t -> elt option
|
val find_last_opt : (elt -> bool) -> t -> elt option
|
||||||
(** Safe version of {!find_last}
|
(** Safe version of {!find_last}
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val of_seq : elt sequence -> t
|
val of_seq : elt sequence -> t
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ val equal : string -> string -> bool
|
||||||
val compare : string -> string -> int
|
val compare : string -> string -> int
|
||||||
|
|
||||||
val is_empty : string -> bool
|
val is_empty : string -> bool
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 1.5 *)
|
||||||
|
|
||||||
val hash : string -> int
|
val hash : string -> int
|
||||||
|
|
||||||
|
|
@ -504,7 +504,7 @@ module Split : sig
|
||||||
- [{first=true; last=true}] will return ["a"; "b"]
|
- [{first=true; last=true}] will return ["a"; "b"]
|
||||||
|
|
||||||
The default value of all remaining functions is [Drop_none].
|
The default value of all remaining functions is [Drop_none].
|
||||||
@since NEXT_RELEASE
|
@since 1.5
|
||||||
*)
|
*)
|
||||||
type drop_if_empty = {
|
type drop_if_empty = {
|
||||||
first: bool;
|
first: bool;
|
||||||
|
|
@ -513,7 +513,7 @@ module Split : sig
|
||||||
|
|
||||||
val no_drop : drop_if_empty
|
val no_drop : drop_if_empty
|
||||||
(** Do not drop any group, even empty and on borders
|
(** 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
|
val list_ : ?drop:drop_if_empty -> by:string -> string -> (string*int*int) list
|
||||||
(** Eplit the given string along the given separator [by]. Should only
|
(** Eplit the given string along the given separator [by]. Should only
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ val iter : ('a,'b) t -> ('a -> 'b -> unit) -> unit
|
||||||
val add : ('a, 'b) t -> 'a -> 'b -> bool
|
val add : ('a, 'b) t -> 'a -> 'b -> bool
|
||||||
(** Manually add a cached value. Returns [true] if the value has succesfully
|
(** Manually add a cached value. Returns [true] if the value has succesfully
|
||||||
been added, and [false] if the value was already bound.
|
been added, and [false] if the value was already bound.
|
||||||
@since NEXT_RELEASE *)
|
@since 1.5 *)
|
||||||
|
|
||||||
val dummy : ('a,'b) t
|
val dummy : ('a,'b) t
|
||||||
(** Dummy cache, never stores any value *)
|
(** Dummy cache, never stores any value *)
|
||||||
|
|
|
||||||
|
|
@ -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
|
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.
|
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
|
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue