mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
Merge pull request #60 from johanneskloos/master
Make `CCPersistentHashtbl.S.merge` more general.
This commit is contained in:
commit
69e8f7abf8
3 changed files with 6 additions and 5 deletions
|
|
@ -13,3 +13,4 @@
|
|||
- Guillaume Bury (guigui)
|
||||
- JP Rodi
|
||||
- octachron (Florian Angeletti)
|
||||
- Johannes Kloos
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ module type S = sig
|
|||
(** Fresh copy of the table; the underlying structure is not shared
|
||||
anymore, so using both tables alternatively will be efficient *)
|
||||
|
||||
val merge : (key -> 'a option -> 'a option -> 'a option) ->
|
||||
'a t -> 'a t -> 'a t
|
||||
val merge : (key -> 'a option -> 'b option -> 'c option) ->
|
||||
'a t -> 'b t -> 'c t
|
||||
(** Merge two tables together into a new table. The function's argument
|
||||
correspond to values associated with the key (if present); if the
|
||||
function returns [None] the key will not appear in the result. *)
|
||||
|
|
@ -576,7 +576,7 @@ module Make(H : HashedType) : S with type key = H.t = struct
|
|||
if mem t1 k then tbl
|
||||
else match f k None (Some v2) with
|
||||
| None -> tbl
|
||||
| Some _ -> replace tbl k v2
|
||||
| Some v' -> replace tbl k v'
|
||||
) tbl t2
|
||||
|
||||
(*$R
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ module type S = sig
|
|||
(** Fresh copy of the table; the underlying structure is not shared
|
||||
anymore, so using both tables alternatively will be efficient *)
|
||||
|
||||
val merge : (key -> 'a option -> 'a option -> 'a option) ->
|
||||
'a t -> 'a t -> 'a t
|
||||
val merge : (key -> 'a option -> 'b option -> 'c option) ->
|
||||
'a t -> 'b t -> 'c t
|
||||
(** Merge two tables together into a new table. The function's argument
|
||||
correspond to values associated with the key (if present); if the
|
||||
function returns [None] the key will not appear in the result. *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue