Skip to content

Commit

Permalink
prepare for 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jun 6, 2023
1 parent e6afa76 commit 81acaaa
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 25 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 3.12

- add `containers.pp` sublibrary, with Wadler-style pretty printing combinators
- add `CCArray.{max,argmax,min,argmin}` and their _exn counterparts
- add `CCParse.take_until_success`
- add `Option.flat_map_l`
- add `CCSet.{find_first_map,find_last_map}`
- `CCHash`: native FNV hash for int64/int32

- fix bugs in CCParse related to `recurse` and `Slice`
- fix: fix Set.find_last_map on OCaml 4.03
- fix: make sure `Vector.to_{seq,gen}` captures the length initially

## 3.11

- official OCaml 5 support
Expand Down
2 changes: 1 addition & 1 deletion containers-data.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "3.11"
version: "3.12"
author: "Simon Cruanes"
maintainer: "simon.cruanes.2007@m4x.org"
synopsis: "A set of advanced datatypes for containers"
Expand Down
2 changes: 1 addition & 1 deletion containers-thread.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "3.11"
version: "3.12"
author: "Simon Cruanes"
maintainer: "simon.cruanes.2007@m4x.org"
license: "BSD-2-Clause"
Expand Down
2 changes: 1 addition & 1 deletion containers.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "containers"
version: "3.11"
version: "3.12"
author: "Simon Cruanes"
maintainer: "simon.cruanes.2007@m4x.org"
license: "BSD-2-Clause"
Expand Down
16 changes: 8 additions & 8 deletions src/core/CCArray.mli
Original file line number Diff line number Diff line change
Expand Up @@ -145,43 +145,43 @@ val find_idx : ('a -> bool) -> 'a t -> (int * 'a) option
val max : ('a -> 'a -> int) -> 'a t -> 'a option
(** [max cmp a] returns [None] if [a] is empty, otherwise, returns [Some e] where [e]
is a maximum element in [a] with respect to [cmp].
@since NEXT_RELEASE *)
@since 3.12 *)

val max_exn : ('a -> 'a -> int) -> 'a t -> 'a
(** [max_exn cmp a] is like {!max}, but
@raise Invalid_argument if [a] is empty.
@since NEXT_RELEASE *)
@since 3.12 *)


val argmax : ('a -> 'a -> int) -> 'a t -> int option
(** [argmax cmp a] returns [None] if [a] is empty, otherwise, returns [Some i] where [i]
is the index of a maximum element in [a] with respect to [cmp].
@since NEXT_RELEASE *)
@since 3.12 *)

val argmax_exn : ('a -> 'a -> int) -> 'a t -> int
(** [argmax_exn cmp a] is like {!argmax}, but
@raise Invalid_argument if [a] is empty.
@since NEXT_RELEASE *)
@since 3.12 *)

val min : ('a -> 'a -> int) -> 'a t -> 'a option
(** [min cmp a] returns [None] if [a] is empty, otherwise, returns [Some e] where [e]
is a minimum element in [a] with respect to [cmp].
@since NEXT_RELEASE *)
@since 3.12 *)

val min_exn : ('a -> 'a -> int) -> 'a t -> 'a
(** [min_exn cmp a] is like {!min}, but
@raise Invalid_argument if [a] is empty.
@since NEXT_RELEASE *)
@since 3.12 *)

val argmin : ('a -> 'a -> int) -> 'a t -> int option
(** [argmin cmp a] returns [None] if [a] is empty, otherwise, returns [Some i] where [i]
is the index of a minimum element in [a] with respect to [cmp].
@since NEXT_RELEASE *)
@since 3.12 *)

val argmin_exn : ('a -> 'a -> int) -> 'a t -> int
(** [argmin_exn cmp a] is like {!argmin}, but
@raise Invalid_argument if [a] is empty.
@since NEXT_RELEASE *)
@since 3.12 *)

val lookup : cmp:'a ord -> 'a -> 'a t -> int option
(** [lookup ~cmp key a] lookups the index of some key [key] in a sorted array [a].
Expand Down
16 changes: 8 additions & 8 deletions src/core/CCArrayLabels.mli
Original file line number Diff line number Diff line change
Expand Up @@ -144,43 +144,43 @@ val find_idx : f:('a -> bool) -> 'a t -> (int * 'a) option
val max : cmp:('a -> 'a -> int) -> 'a t -> 'a option
(** [max ~cmp a] returns [None] if [a] is empty, otherwise, returns [Some e] where [e]
is a maximum element in [a] with respect to [cmp].
@since NEXT_RELEASE *)
@since 3.12 *)

val max_exn : cmp:('a -> 'a -> int) -> 'a t -> 'a
(** [max_exn ~cmp a] is like {!max}, but
@raise Invalid_argument if [a] is empty.
@since NEXT_RELEASE *)
@since 3.12 *)


val argmax : cmp:('a -> 'a -> int) -> 'a t -> int option
(** [argmax ~cmp a] returns [None] if [a] is empty, otherwise, returns [Some i] where [i]
is the index of a maximum element in [a] with respect to [cmp].
@since NEXT_RELEASE *)
@since 3.12 *)

val argmax_exn : cmp:('a -> 'a -> int) -> 'a t -> int
(** [argmax_exn ~cmp a] is like {!argmax}, but
@raise Invalid_argument if [a] is empty.
@since NEXT_RELEASE *)
@since 3.12 *)

val min : cmp:('a -> 'a -> int) -> 'a t -> 'a option
(** [min ~cmp a] returns [None] if [a] is empty, otherwise, returns [Some e] where [e]
is a minimum element in [a] with respect to [cmp].
@since NEXT_RELEASE *)
@since 3.12 *)

val min_exn : cmp:('a -> 'a -> int) -> 'a t -> 'a
(** [min_exn ~cmp a] is like {!min}, but
@raise Invalid_argument if [a] is empty.
@since NEXT_RELEASE *)
@since 3.12 *)

val argmin : cmp:('a -> 'a -> int) -> 'a t -> int option
(** [argmin ~cmp a] returns [None] if [a] is empty, otherwise, returns [Some i] where [i]
is the index of a minimum element in [a] with respect to [cmp].
@since NEXT_RELEASE *)
@since 3.12 *)

val argmin_exn : cmp:('a -> 'a -> int) -> 'a t -> int
(** [argmin_exn ~cmp a] is like {!argmin}, but
@raise Invalid_argument if [a] is empty.
@since NEXT_RELEASE *)
@since 3.12 *)

val lookup : cmp:('a ord[@keep_label]) -> key:'a -> 'a t -> int option
(** [lookup ~cmp ~key a] lookups the index of some key [key] in a sorted array [a].
Expand Down
2 changes: 1 addition & 1 deletion src/core/CCOption.mli
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ val flat_map : ('a -> 'b t) -> 'a t -> 'b t

val flat_map_l : ('a -> 'b list) -> 'a t -> 'b list
(** [flat_map_l f o] is [[]] if [o] is [None], or [f x] if [o] is [Some x].
@since NEXT_RELEASE *)
@since 3.12 *)

val bind : 'a t -> ('a -> 'b t) -> 'b t
(** [bind o f] is [f v] if [o] is [Some v], [None] otherwise.
Expand Down
2 changes: 1 addition & 1 deletion src/core/CCParse.mli
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ val take_until_success : 'a t -> (slice * 'a) t
{b NOTE} performance wise, if [p] does a lot of work at each position,
this can be costly (thing naive substring search if [p] is [string "very long needle"]).
@since NEXT_RELEASE *)
@since 3.12 *)

val take : int -> slice t
(** [take len] parses exactly [len] characters from the input.
Expand Down
4 changes: 2 additions & 2 deletions src/core/CCSet.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module type S = sig
val find_first_map : (elt -> 'a option) -> t -> 'a option
(** [find_first_map f s] find the minimum element [x] of [s] such that [f x = Some y]
and return [Some y]. Otherwise returns [None].
@since NEXT_RELEASE *)
@since 3.12 *)

val find_last : (elt -> bool) -> t -> elt
(** Find maximum element satisfying predicate.
Expand All @@ -50,7 +50,7 @@ module type S = sig
val find_last_map : (elt -> 'a option) -> t -> 'a option
(** [find_last_map f s] find the maximum element [x] of [s] such that [f x = Some y]
and return [Some y]. Otherwise returns [None].
@since NEXT_RELEASE *)
@since 3.12 *)

val of_iter : elt iter -> t
(** Build a set from the given [iter] of elements.
Expand Down
4 changes: 2 additions & 2 deletions src/core/CCSet.mli
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module type S = sig
val find_first_map : (elt -> 'a option) -> t -> 'a option
(** [find_first_map f s] find the minimum element [x] of [s] such that [f x = Some y]
and return [Some y]. Otherwise returns [None].
@since NEXT_RELEASE *)
@since 3.12 *)

val find_last : (elt -> bool) -> t -> elt
(** Find maximum element satisfying predicate.
Expand All @@ -56,7 +56,7 @@ module type S = sig
val find_last_map : (elt -> 'a option) -> t -> 'a option
(** [find_last_map f s] find the maximum element [x] of [s] such that [f x = Some y]
and return [Some y]. Otherwise returns [None].
@since NEXT_RELEASE *)
@since 3.12 *)

val of_iter : elt iter -> t
(** Build a set from the given [iter] of elements.
Expand Down

0 comments on commit 81acaaa

Please sign in to comment.