mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2026-01-25 18:46:42 -05:00
add CCMap.{keys,values}
This commit is contained in:
parent
99919ae1d3
commit
191953feaf
2 changed files with 22 additions and 0 deletions
|
|
@ -53,6 +53,14 @@ module type S = sig
|
|||
val add_list : 'a t -> (key * 'a) list -> 'a t
|
||||
(** @since 0.14 *)
|
||||
|
||||
val keys : _ t -> key sequence
|
||||
(** Iterate on keys only
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val values : 'a t -> 'a sequence
|
||||
(** Iterate on values only
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val to_list : 'a t -> (key * 'a) list
|
||||
|
||||
val pp : ?start:string -> ?stop:string -> ?arrow:string -> ?sep:string ->
|
||||
|
|
@ -88,6 +96,12 @@ module Make(O : Map.OrderedType) = struct
|
|||
let to_seq m yield =
|
||||
iter (fun k v -> yield (k,v)) m
|
||||
|
||||
let keys m yield =
|
||||
iter (fun k _ -> yield k) m
|
||||
|
||||
let values m yield =
|
||||
iter (fun _ v -> yield v) m
|
||||
|
||||
let add_list m l = List.fold_left (fun m (k,v) -> add k v m) m l
|
||||
|
||||
let of_list l = add_list empty l
|
||||
|
|
|
|||
|
|
@ -56,6 +56,14 @@ module type S = sig
|
|||
val add_list : 'a t -> (key * 'a) list -> 'a t
|
||||
(** @since 0.14 *)
|
||||
|
||||
val keys : _ t -> key sequence
|
||||
(** Iterate on keys only
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val values : 'a t -> 'a sequence
|
||||
(** Iterate on values only
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val to_list : 'a t -> (key * 'a) list
|
||||
|
||||
val pp : ?start:string -> ?stop:string -> ?arrow:string -> ?sep:string ->
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue