prepare for 3.3

This commit is contained in:
Simon Cruanes 2021-04-01 22:16:40 -04:00
parent 13028c3d17
commit 739dd4412c
18 changed files with 80 additions and 51 deletions

View file

@ -1,5 +1,30 @@
# Changelog # Changelog
## 3.3
- feat: add code-generator for optimal bitfields; add tests
- new Canonical sexpr module with printer and parser
- CCSeq: Add `for_all` and `exists`
- feat(sexp): expose last location in decoder
- feat(CCChar): add CCChar.Infix
- feat(CCString): add CCString.foldi
- feat(CCFormat): add `string_lines` combinator
- feat(CCList): update with regards to `partition_map`
- add `CCList.cons'`
- implement {of,add}_*_with family of function in `CCMap` with update (#352)
- add `CCMap.of_{list,iter,seq}_with` functions
- add `CCHashtbl.{of,add}_{list,seq,iter}_with`
- Fix integer overflow warning on jsoo (#346)
- updated fuzzer scripts
### Containers-thread
- refactor(pool): less locking, fix deadlock, more parallelism
- feat(pool): keep one idle thread
- small optim in `Pool.sequence_a`
## 3.2 ## 3.2
- add CCEither module - add CCEither module

View file

@ -431,7 +431,7 @@ map =
- : string option = Some "33" - : string option = Some "33"
``` ```
### New types: `CCVector`, `CCHeap`, `CCResult` ### New types: `CCVector`, `CCHeap`, `CCResult`, `CCSexp`
Containers also contains (!) a few datatypes that are not from the standard Containers also contains (!) a few datatypes that are not from the standard
library but that are useful in a lot of situations: library but that are useful in a lot of situations:
@ -454,6 +454,10 @@ library but that are useful in a lot of situations:
It uses the new `result` type from the standard library (or from It uses the new `result` type from the standard library (or from
the retrocompatibility package on opam) and provides the retrocompatibility package on opam) and provides
many combinators for dealing with `result`. many combinators for dealing with `result`.
- `CCSexp` and `CCCanonical_sexp`:
functorized printer and parser for S-expressions, respectively as
actual S-expressions (like `sexplib`) and as canonical binary-safe
S-expressions (like `csexp`)
Now for a few examples: Now for a few examples:

View file

@ -1,5 +1,5 @@
opam-version: "2.0" opam-version: "2.0"
version: "3.2" version: "3.3"
author: "Simon Cruanes" author: "Simon Cruanes"
maintainer: "simon.cruanes.2007@m4x.org" maintainer: "simon.cruanes.2007@m4x.org"
synopsis: "A set of advanced datatypes for containers" synopsis: "A set of advanced datatypes for containers"

View file

@ -1,5 +1,5 @@
opam-version: "2.0" opam-version: "2.0"
version: "3.2" version: "3.3"
author: "Simon Cruanes" author: "Simon Cruanes"
maintainer: "simon.cruanes.2007@m4x.org" maintainer: "simon.cruanes.2007@m4x.org"
synopsis: "An extension of containers for threading" synopsis: "An extension of containers for threading"

View file

@ -1,6 +1,6 @@
opam-version: "2.0" opam-version: "2.0"
name: "containers" name: "containers"
version: "3.2" version: "3.3"
author: "Simon Cruanes" author: "Simon Cruanes"
maintainer: "simon.cruanes.2007@m4x.org" maintainer: "simon.cruanes.2007@m4x.org"
synopsis: "A modular, clean and powerful extension of the OCaml standard library" synopsis: "A modular, clean and powerful extension of the OCaml standard library"

View file

@ -6,7 +6,7 @@
See {{: https://en.wikipedia.org/wiki/Canonical_S-expressions} wikipedia}. See {{: https://en.wikipedia.org/wiki/Canonical_S-expressions} wikipedia}.
These S-expressions are binary safe. These S-expressions are binary safe.
@since NEXT_RELEASE @since 3.3
*) *)
type 'a or_error = ('a, string) result type 'a or_error = ('a, string) result

View file

@ -40,26 +40,26 @@ val pp : Format.formatter -> t -> unit
(** {2 Infix Operators} (** {2 Infix Operators}
@since NEXT_RELEASE *) @since 3.3 *)
module Infix : sig module Infix : sig
val (=) : t -> t -> bool val (=) : t -> t -> bool
(** @since NEXT_RELEASE *) (** @since 3.3 *)
val (<>) : t -> t -> bool val (<>) : t -> t -> bool
(** @since NEXT_RELEASE *) (** @since 3.3 *)
val (<) : t -> t -> bool val (<) : t -> t -> bool
(** @since NEXT_RELEASE *) (** @since 3.3 *)
val (>) : t -> t -> bool val (>) : t -> t -> bool
(** @since NEXT_RELEASE *) (** @since 3.3 *)
val (<=) : t -> t -> bool val (<=) : t -> t -> bool
(** @since NEXT_RELEASE *) (** @since 3.3 *)
val (>=) : t -> t -> bool val (>=) : t -> t -> bool
(** @since NEXT_RELEASE *) (** @since 3.3 *)
end end
include module type of Infix include module type of Infix

View file

@ -69,7 +69,7 @@ val string_lines : string printer
place of spaces, unlike {!text}. place of spaces, unlike {!text}.
This means an already formatted string can be displayed inside another This means an already formatted string can be displayed inside another
formatter without mangling the indentation. formatter without mangling the indentation.
@since NEXT_RELEASE *) @since 3.3 *)
val char : char printer (** @since 0.14 *) val char : char printer (** @since 0.14 *)

View file

@ -236,7 +236,7 @@ module type S = sig
(** Add the corresponding pairs to the table, using {!Hashtbl.add}. (** Add the corresponding pairs to the table, using {!Hashtbl.add}.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val add_seq : 'a t -> (key * 'a) Seq.t -> unit val add_seq : 'a t -> (key * 'a) Seq.t -> unit
(** Add the corresponding pairs to the table, using {!Hashtbl.add}. (** Add the corresponding pairs to the table, using {!Hashtbl.add}.
@ -249,7 +249,7 @@ module type S = sig
(** Add the corresponding pairs to the table, using {!Hashtbl.add}. (** Add the corresponding pairs to the table, using {!Hashtbl.add}.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val of_iter : (key * 'a) iter -> 'a t val of_iter : (key * 'a) iter -> 'a t
(** From the given bindings, added in order. (** From the given bindings, added in order.
@ -261,7 +261,7 @@ module type S = sig
(** From the given bindings, added in order. (** From the given bindings, added in order.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val of_seq : (key * 'a) Seq.t -> 'a t val of_seq : (key * 'a) Seq.t -> 'a t
(** From the given bindings, added in order. (** From the given bindings, added in order.
@ -274,7 +274,7 @@ module type S = sig
(** From the given bindings, added in order. (** From the given bindings, added in order.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val add_iter_count : int t -> key iter -> unit val add_iter_count : int t -> key iter -> unit
(** [add_iter_count tbl i] increments the count of each element of [i] (** [add_iter_count tbl i] increments the count of each element of [i]
@ -313,7 +313,7 @@ module type S = sig
(** [of_list l] builds a table from the given list [l] of bindings [k_i -> v_i]. (** [of_list l] builds a table from the given list [l] of bindings [k_i -> v_i].
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit
(** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if (** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if

View file

@ -78,7 +78,7 @@ module Poly : sig
(** Add the corresponding pairs to the table, using {!Hashtbl.add}. (** Add the corresponding pairs to the table, using {!Hashtbl.add}.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val add_seq : ('a,'b) Hashtbl.t -> ('a * 'b) Seq.t -> unit val add_seq : ('a,'b) Hashtbl.t -> ('a * 'b) Seq.t -> unit
(** Add the corresponding pairs to the table, using {!Hashtbl.add}. (** Add the corresponding pairs to the table, using {!Hashtbl.add}.
@ -91,7 +91,7 @@ module Poly : sig
(** Add the corresponding pairs to the table. (** Add the corresponding pairs to the table.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val of_iter : ('a * 'b) iter -> ('a,'b) Hashtbl.t val of_iter : ('a * 'b) iter -> ('a,'b) Hashtbl.t
(** From the given bindings, added in order. (** From the given bindings, added in order.
@ -103,7 +103,7 @@ module Poly : sig
(** From the given bindings, added in order. (** From the given bindings, added in order.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val of_seq : ('a * 'b) Seq.t -> ('a,'b) Hashtbl.t val of_seq : ('a * 'b) Seq.t -> ('a,'b) Hashtbl.t
(** From the given bindings, added in order. (** From the given bindings, added in order.
@ -116,7 +116,7 @@ module Poly : sig
(** From the given bindings, added in order. (** From the given bindings, added in order.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val add_iter_count : ('a, int) Hashtbl.t -> 'a iter -> unit val add_iter_count : ('a, int) Hashtbl.t -> 'a iter -> unit
(** [add_iter_count tbl i] increments the count of each element of [i] (** [add_iter_count tbl i] increments the count of each element of [i]
@ -155,7 +155,7 @@ module Poly : sig
(** From the given bindings, added in order. (** From the given bindings, added in order.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val update : ('a, 'b) Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> unit val update : ('a, 'b) Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> unit
(** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if (** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if
@ -251,7 +251,7 @@ module type S = sig
(** Add the corresponding pairs to the table, using {!Hashtbl.add}. (** Add the corresponding pairs to the table, using {!Hashtbl.add}.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val add_seq : 'a t -> (key * 'a) Seq.t -> unit val add_seq : 'a t -> (key * 'a) Seq.t -> unit
(** Add the corresponding pairs to the table, using {!Hashtbl.add}. (** Add the corresponding pairs to the table, using {!Hashtbl.add}.
@ -264,7 +264,7 @@ module type S = sig
(** Add the corresponding pairs to the table, using {!Hashtbl.add}. (** Add the corresponding pairs to the table, using {!Hashtbl.add}.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val of_iter : (key * 'a) iter -> 'a t val of_iter : (key * 'a) iter -> 'a t
(** From the given bindings, added in order. (** From the given bindings, added in order.
@ -276,7 +276,7 @@ module type S = sig
(** From the given bindings, added in order. (** From the given bindings, added in order.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val of_seq : (key * 'a) Seq.t -> 'a t val of_seq : (key * 'a) Seq.t -> 'a t
(** From the given bindings, added in order. (** From the given bindings, added in order.
@ -289,7 +289,7 @@ module type S = sig
(** From the given bindings, added in order. (** From the given bindings, added in order.
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val add_iter_count : int t -> key iter -> unit val add_iter_count : int t -> key iter -> unit
(** [add_iter_count tbl i] increments the count of each element of [i] (** [add_iter_count tbl i] increments the count of each element of [i]
@ -328,7 +328,7 @@ module type S = sig
(** [of_list l] builds a table from the given list [l] of bindings [k_i -> v_i]. (** [of_list l] builds a table from the given list [l] of bindings [k_i -> v_i].
If a key occurs multiple times in the input, the values are combined If a key occurs multiple times in the input, the values are combined
using [f] in an unspecified order. using [f] in an unspecified order.
@since NEXT_RELEASE *) @since 3.3 *)
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit
(** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if (** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if

View file

@ -43,7 +43,7 @@ val cons_maybe : 'a option -> 'a t -> 'a t
val cons' : 'a t -> 'a -> 'a t val cons' : 'a t -> 'a -> 'a t
(** [cons' l x] is the same as [x :: l]. This is convenient for fold (** [cons' l x] is the same as [x :: l]. This is convenient for fold
functions such as {!List.fold_left} or {!Array.fold_left}. functions such as {!List.fold_left} or {!Array.fold_left}.
@since NEXT_RELEASE *) @since 3.3 *)
val (@) : 'a t -> 'a t -> 'a t val (@) : 'a t -> 'a t -> 'a t
(** [l1 @ l2] is like [append l1 l2]. (** [l1 @ l2] is like [append l1 l2].
@ -236,7 +236,7 @@ val partition_map_either : ('a -> ('b, 'c) CCEither.t) ->
(** [partition_map_either f l] maps [f] on [l] and gather results in lists: (** [partition_map_either f l] maps [f] on [l] and gather results in lists:
- if [f x = Left y], adds [y] to the first list. - if [f x = Left y], adds [y] to the first list.
- if [f x = Right z], adds [z] to the second list. - if [f x = Right z], adds [z] to the second list.
@since NEXT_RELEASE *) @since 3.3 *)
val partition_filter_map : ('a -> [<`Left of 'b | `Right of 'c | `Drop]) -> val partition_filter_map : ('a -> [<`Left of 'b | `Right of 'c | `Drop]) ->
'a list -> 'b list * 'c list 'a list -> 'b list * 'c list

View file

@ -42,7 +42,7 @@ val append : 'a t -> 'a t -> 'a t
val cons' : 'a t -> 'a -> 'a t val cons' : 'a t -> 'a -> 'a t
(** [cons' l x] is the same as [x :: l]. This is convenient for fold (** [cons' l x] is the same as [x :: l]. This is convenient for fold
functions such as {!List.fold_left} or {!Array.fold_left}. functions such as {!List.fold_left} or {!Array.fold_left}.
@since NEXT_RELEASE *) @since 3.3 *)
val cons_maybe : 'a option -> 'a t -> 'a t val cons_maybe : 'a option -> 'a t -> 'a t
(** [cons_maybe (Some x) l] is [x :: l]. (** [cons_maybe (Some x) l] is [x :: l].
@ -240,7 +240,7 @@ val partition_map_either : f:('a -> ('b, 'c) CCEither.t) ->
(** [partition_map_either ~f l] maps [f] on [l] and gather results in lists: (** [partition_map_either ~f l] maps [f] on [l] and gather results in lists:
- if [f x = Left y], adds [y] to the first list. - if [f x = Left y], adds [y] to the first list.
- if [f x = Right z], adds [z] to the second list. - if [f x = Right z], adds [z] to the second list.
@since NEXT_RELEASE *) @since 3.3 *)
val partition_filter_map : f:('a -> [<`Left of 'b | `Right of 'c | `Drop]) -> val partition_filter_map : f:('a -> [<`Left of 'b | `Right of 'c | `Drop]) ->
'a list -> 'b list * 'c list 'a list -> 'b list * 'c list

View file

@ -77,7 +77,7 @@ module type S = sig
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Seq.t -> 'a t val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Seq.t -> 'a t
(** [add_seq ~f m l] adds the given seq [l] of bindings to the map [m], (** [add_seq ~f m l] adds the given seq [l] of bindings to the map [m],
using [f] to combine values that have the same key. using [f] to combine values that have the same key.
@since NEXT_RELEASE *) @since 3.3 *)
val of_seq : (key * 'a) Seq.t -> 'a t val of_seq : (key * 'a) Seq.t -> 'a t
(** [of_seq seq] builds a map from the given [Seq.t] of bindings. (** [of_seq seq] builds a map from the given [Seq.t] of bindings.
@ -91,7 +91,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the seq than [v2]. later in the seq than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val add_iter : 'a t -> (key * 'a) iter -> 'a t val add_iter : 'a t -> (key * 'a) iter -> 'a t
(** [add_iter m iter] adds the given [iter] of bindings to the map [m]. (** [add_iter m iter] adds the given [iter] of bindings to the map [m].
@ -101,7 +101,7 @@ module type S = sig
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) iter -> 'a t val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) iter -> 'a t
(** [add_iter ~f m l] adds the given iter [l] of bindings to the map [m], (** [add_iter ~f m l] adds the given iter [l] of bindings to the map [m],
using [f] to combine values that have the same key. using [f] to combine values that have the same key.
@since NEXT_RELEASE *) @since 3.3 *)
val of_iter : (key * 'a) iter -> 'a t val of_iter : (key * 'a) iter -> 'a t
(** [of_iter iter] builds a map from the given [iter] of bindings. (** [of_iter iter] builds a map from the given [iter] of bindings.
@ -114,7 +114,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the iter than [v2]. later in the iter than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val to_iter : 'a t -> (key * 'a) iter val to_iter : 'a t -> (key * 'a) iter
(** [to_iter m] iterates on the whole map [m], creating an [iter] of bindings. (** [to_iter m] iterates on the whole map [m], creating an [iter] of bindings.
@ -133,7 +133,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the list than [v2]. later in the list than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val add_list : 'a t -> (key * 'a) list -> 'a t val add_list : 'a t -> (key * 'a) list -> 'a t
(** [add_list m l] adds the given list [l] of bindings to the map [m]. (** [add_list m l] adds the given list [l] of bindings to the map [m].
@ -142,7 +142,7 @@ module type S = sig
val add_list_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) list -> 'a t val add_list_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) list -> 'a t
(** [add_list ~f m l] adds the given list [l] of bindings to the map [m], (** [add_list ~f m l] adds the given list [l] of bindings to the map [m],
using [f] to combine values that have the same key. using [f] to combine values that have the same key.
@since NEXT_RELEASE *) @since 3.3 *)
val keys : _ t -> key iter val keys : _ t -> key iter
(** [keys m] iterates on the keys of [m] only, creating an [iter] of keys. (** [keys m] iterates on the keys of [m] only, creating an [iter] of keys.

View file

@ -87,7 +87,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the seq than [v2]. later in the seq than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val of_seq : (key * 'a) Seq.t -> 'a t val of_seq : (key * 'a) Seq.t -> 'a t
(** [of_seq seq] builds a map from the given [Seq.t] of bindings. (** [of_seq seq] builds a map from the given [Seq.t] of bindings.
@ -101,7 +101,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the seq than [v2]. later in the seq than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val add_iter : 'a t -> (key * 'a) iter -> 'a t val add_iter : 'a t -> (key * 'a) iter -> 'a t
(** [add_iter m iter] adds the given [iter] of bindings to the map [m]. (** [add_iter m iter] adds the given [iter] of bindings to the map [m].
@ -114,7 +114,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the seq than [v2]. later in the seq than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val of_iter : (key * 'a) iter -> 'a t val of_iter : (key * 'a) iter -> 'a t
(** [of_iter iter] builds a map from the given [iter] of bindings. (** [of_iter iter] builds a map from the given [iter] of bindings.
@ -127,7 +127,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the iter than [v2]. later in the iter than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val to_iter : 'a t -> (key * 'a) iter val to_iter : 'a t -> (key * 'a) iter
(** [to_iter m] iterates on the whole map [m], creating an [iter] of bindings. (** [to_iter m] iterates on the whole map [m], creating an [iter] of bindings.
@ -146,7 +146,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the list than [v2]. later in the list than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val add_list : 'a t -> (key * 'a) list -> 'a t val add_list : 'a t -> (key * 'a) list -> 'a t
(** [add_list m l] adds the given list [l] of bindings to the map [m]. (** [add_list m l] adds the given list [l] of bindings to the map [m].
@ -158,7 +158,7 @@ module type S = sig
If a key occurs several times, all its bindings are combined using the If a key occurs several times, all its bindings are combined using the
function [f], with [f key v1 v2] being called with [v1] occurring function [f], with [f key v1 v2] being called with [v1] occurring
later in the seq than [v2]. later in the seq than [v2].
@since NEXT_RELEASE *) @since 3.3 *)
val keys : _ t -> key iter val keys : _ t -> key iter
(** [keys m] iterates on the keys of [m] only, creating an [iter] of keys. (** [keys m] iterates on the keys of [m] only, creating an [iter] of keys.

View file

@ -131,14 +131,14 @@ val for_all : ('a -> bool) -> 'a t -> bool
predicate [p]. That is, it returns [(p a1) && ... && (p an)] for a 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 non-empty list and [true] if the sequence is empty. It consumes the
sequence until it finds an element not satisfying the predicate. sequence until it finds an element not satisfying the predicate.
@since NEXT_RELEASE *) @since 3.3 *)
val exists : ('a -> bool) -> 'a t -> bool val exists : ('a -> bool) -> 'a t -> bool
(** [exists p [a1; ...; an]] checks if at least one element of the sequence (** [exists p [a1; ...; an]] checks if at least one element of the sequence
satisfies the predicate [p]. That is, it returns [(p a1) || ... || (p an)] 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 for a non-empty sequence and [false] if the list is empty. It consumes the
sequence until it finds an element satisfying the predicate. sequence until it finds an element satisfying the predicate.
@since NEXT_RELEASE *) @since 3.3 *)
val flat_map : ('a -> 'b t) -> 'a t -> 'b t val flat_map : ('a -> 'b t) -> 'a t -> 'b t

View file

@ -4,7 +4,7 @@ type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option type 'a gen = unit -> 'a option
(** {2 Abstract representation of S-expressions} (** {2 Abstract representation of S-expressions}
@since NEXT_RELEASE *) @since 3.3 *)
module type BASIC_SEXP = sig module type BASIC_SEXP = sig
type t type t
@ -126,7 +126,7 @@ module type S = sig
type loc type loc
(** Locations for the S-expressions. (** Locations for the S-expressions.
@since NEXT_RELEASE *) @since 3.3 *)
(** {2 Parsing} *) (** {2 Parsing} *)
@ -156,6 +156,6 @@ module type S = sig
(** Last location for the decoder. In particular, (** Last location for the decoder. In particular,
after calling {!next}, this gives the location of the last token after calling {!next}, this gives the location of the last token
used in the result, which is useful in case of error. used in the result, which is useful in case of error.
@since NEXT_RELEASE *) @since 3.3 *)
end end
end end

View file

@ -37,7 +37,7 @@ val fold : ('a -> char -> 'a) -> 'a -> t -> 'a
val foldi : ('a -> int -> char -> 'a) -> 'a -> t -> 'a val foldi : ('a -> int -> char -> 'a) -> 'a -> t -> 'a
(** [foldi f init s] is just like {!fold}, but it also passes in the index of each chars (** [foldi f init s] is just like {!fold}, but it also passes in the index of each chars
as second argument to the folded function [f]. as second argument to the folded function [f].
@since NEXT_RELEASE *) @since 3.3 *)
(** {2 Conversions} *) (** {2 Conversions} *)

View file

@ -37,7 +37,7 @@ val fold : f:('a -> char -> 'a) -> init:'a -> t -> 'a
val foldi : f:('a -> int -> char -> 'a) -> 'a -> t -> 'a val foldi : f:('a -> int -> char -> 'a) -> 'a -> t -> 'a
(** [foldi ~f init s] is just like {!fold}, but it also passes in the index of each chars (** [foldi ~f init s] is just like {!fold}, but it also passes in the index of each chars
as second argument to the folded function [f]. as second argument to the folded function [f].
@since NEXT_RELEASE *) @since 3.3 *)
(** {2 Conversions} *) (** {2 Conversions} *)