diff options
author | Simon Cruanes <simon.cruanes.2007@m4x.org> | 2018-03-16 12:25:10 -0500 |
---|---|---|
committer | Alain Frisch <alain@frisch.fr> | 2018-03-16 18:25:10 +0100 |
commit | df80f34a927e74ea6a920b658303c57c12a1b444 (patch) | |
tree | 103a1fbf6003bdcdfb5f9b0e011935ab6836baa7 /stdlib/map.mli | |
parent | fab457a8f5404c2568f152332d1a6f43b2e111df (diff) | |
download | ocaml-df80f34a927e74ea6a920b658303c57c12a1b444.tar.gz |
Stdlib functional iterators (#1002)
* add `Seq` module, expose iterator conversions in most containers
* small typo
* typo
* change order of arguments for `{Map,Set}.add_seq`
* watch for max string length in `Bytes.of_seq`
* wip: make it build again
* Fix dependency
Sys needs to be linked before Bytes in stdlib.
* Update threads/stdlib.ml
* Update stdlib_no_prefixed/.depend
* fix inconsistencies with label modules
* update testsuite to work with seq
* update change file
* small change in `Hashtbl.to_seq`, capturing only the underlying array
* add some documentation to seq.mli
* revert to good ol' module type names for hashtables
* fix test
* change style of comments in seq.mli
* follow some demands in review of GPR #1002
* some fixes for #1002
* add Seq-related functions to Ephemeron
* add some comments on `Hashtbl.of_seq`
* add more tests for `Hashtbl.{to,of}_seq`
* fix bug in `Ephemeron.to_seq`
* Update Changes
Diffstat (limited to 'stdlib/map.mli')
-rw-r--r-- | stdlib/map.mli | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/stdlib/map.mli b/stdlib/map.mli index 7552c480a5..531fb8fe6c 100644 --- a/stdlib/map.mli +++ b/stdlib/map.mli @@ -306,7 +306,24 @@ module type S = (** Same as {!Map.S.map}, but the function receives as arguments both the key and the associated value for each binding of the map. *) + (** {6 Iterators} *) + val to_seq : 'a t -> (key * 'a) Seq.t + (** Iterate on the whole map, in ascending order + @since 4.07 *) + + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + (** [to_seq_from k m] iterates on a subset of the bindings of [m], + in ascending order, from key [k] or above. + @since 4.07 *) + + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + (** Add the given bindings to the map, in order. + @since 4.07 *) + + val of_seq : (key * 'a) Seq.t -> 'a t + (** Build a map from the given bindings + @since 4.07 *) end (** Output signature of the functor {!Map.Make}. *) |