use more labels in CCHashtrie,CCRAL,CCWBTree

This commit is contained in:
Simon Cruanes 2015-09-21 17:18:43 +02:00
parent f63fd099b0
commit 3c233d9cf3
6 changed files with 111 additions and 112 deletions

View file

@ -65,8 +65,8 @@ module type S = sig
val remove : key -> 'a t -> 'a t
(** Remove the key, if present. *)
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
(** [update k f m] calls [f (Some v)] if [get k m = Some v], [f None]
val update : key -> f:('a option -> 'a option) -> 'a t -> 'a t
(** [update k ~f m] calls [f (Some v)] if [get k m = Some v], [f None]
otherwise. Then, if [f] returns [Some v'] it binds [k] to [v'],
if [f] returns [None] it removes [k] *)
@ -81,7 +81,7 @@ module type S = sig
(** Same as {!remove}, but modifies in place whenever possible
@raise Transient.Frozen if [id] is frozen *)
val update_mut : id:Transient.t -> key -> ('a option -> 'a option) -> 'a t -> 'a t
val update_mut : id:Transient.t -> key -> f:('a option -> 'a option) -> 'a t -> 'a t
(** Same as {!update} but with mutability
@raise Transient.Frozen if [id] is frozen *)
@ -92,9 +92,9 @@ module type S = sig
val choose_exn : 'a t -> key * 'a
(** @raise Not_found if not pair was found *)
val iter : (key -> 'a -> unit) -> 'a t -> unit
val iter : f:(key -> 'a -> unit) -> 'a t -> unit
val fold : ('b -> key -> 'a -> 'b) -> 'b -> 'a t -> 'b
val fold : f:('b -> key -> 'a -> 'b) -> x:'b -> 'a t -> 'b
(** {6 Conversions} *)
@ -559,11 +559,11 @@ module Make(Key : KEY)
| None, Some v -> add_ ~id k v ~h m
| Some _, None -> remove_rec_ ~id k ~h m
let update k f m = update_ ~id:Transient.empty k f m
let update k ~f m = update_ ~id:Transient.empty k f m
let update_mut ~id k v m =
let update_mut ~id k ~f m =
if Transient.frozen id then raise Transient.Frozen;
update_ ~id k v m
update_ ~id k f m
(*$R
let m = M.of_list [1, 1; 2, 2; 5, 5] in
@ -576,7 +576,7 @@ module Make(Key : KEY)
assert_equal [1,1; 2,2; 4,4; 5,5] (M.to_list m' |> List.sort Pervasives.compare);
*)
let iter f t =
let iter ~f t =
let rec aux = function
| E -> ()
| S (_, k, v) -> f k v
@ -590,7 +590,7 @@ module Make(Key : KEY)
in
aux t
let fold f acc t =
let fold ~f ~x:acc t =
let rec aux acc t = match t with
| E -> acc
| S (_,k,v) -> f acc k v
@ -607,13 +607,13 @@ module Make(Key : KEY)
(*$T
let l = CCList.(1 -- 10 |> map (fun x->x,x)) in \
M.of_list l \
|> M.fold (fun acc x y -> (x,y)::acc) [] \
|> M.fold ~f:(fun acc x y -> (x,y)::acc) ~x:[] \
|> List.sort Pervasives.compare = l
*)
let cardinal m = fold (fun n _ _ -> n+1) 0 m
let cardinal m = fold ~f:(fun n _ _ -> n+1) ~x:0 m
let to_list m = fold (fun acc k v -> (k,v)::acc) [] m
let to_list m = fold ~f:(fun acc k v -> (k,v)::acc) ~x:[] m
let add_list_mut ~id m l =
List.fold_left (fun acc (k,v) -> add_mut ~id k v acc) m l
@ -633,7 +633,7 @@ module Make(Key : KEY)
let of_seq s = add_seq empty s
let to_seq m yield = iter (fun k v -> yield (k,v)) m
let to_seq m yield = iter ~f:(fun k v -> yield (k,v)) m
(*$Q
_listuniq (fun l -> \
@ -699,13 +699,13 @@ module Make(Key : KEY)
let print ppk ppv out m =
let first = ref true in
iter
(fun k v ->
iter m
~f:(fun k v ->
if !first then first := false else Format.fprintf out ";@ ";
ppk out k;
Format.pp_print_string out " -> ";
ppv out v
) m
)
let rec as_tree m () = match m with
| E -> `Nil

View file

@ -77,8 +77,8 @@ module type S = sig
val remove : key -> 'a t -> 'a t
(** Remove the key, if present. *)
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
(** [update k f m] calls [f (Some v)] if [get k m = Some v], [f None]
val update : key -> f:('a option -> 'a option) -> 'a t -> 'a t
(** [update k ~f m] calls [f (Some v)] if [get k m = Some v], [f None]
otherwise. Then, if [f] returns [Some v'] it binds [k] to [v'],
if [f] returns [None] it removes [k] *)
@ -93,7 +93,7 @@ module type S = sig
(** Same as {!remove}, but modifies in place whenever possible
@raise Transient.Frozen if [id] is frozen *)
val update_mut : id:Transient.t -> key -> ('a option -> 'a option) -> 'a t -> 'a t
val update_mut : id:Transient.t -> key -> f:('a option -> 'a option) -> 'a t -> 'a t
(** Same as {!update} but with mutability
@raise Transient.Frozen if [id] is frozen *)
@ -104,9 +104,9 @@ module type S = sig
val choose_exn : 'a t -> key * 'a
(** @raise Not_found if not pair was found *)
val iter : (key -> 'a -> unit) -> 'a t -> unit
val iter : f:(key -> 'a -> unit) -> 'a t -> unit
val fold : ('b -> key -> 'a -> 'b) -> 'b -> 'a t -> 'b
val fold : f:('b -> key -> 'a -> 'b) -> x:'b -> 'a t -> 'b
(** {6 Conversions} *)

View file

@ -126,11 +126,11 @@ let rec _map_tree f t = match t with
| Leaf x -> Leaf (f x)
| Node (x, l, r) -> Node (f x, _map_tree f l, _map_tree f r)
let rec map f l = match l with
let rec map ~f l = match l with
| Nil -> Nil
| Cons (i, t, tl) -> Cons (i, _map_tree f t, map f tl)
| Cons (i, t, tl) -> Cons (i, _map_tree f t, map ~f tl)
let mapi f l =
let mapi ~f l =
let rec aux f i l = match l with
| Nil -> Nil
| Cons (size, t, tl) -> Cons (size, aux_t f ~size i t, aux f (i+size) tl)
@ -146,29 +146,29 @@ let mapi f l =
(*$QR
Q.small_int (fun n ->
let l = CCList.(0 -- n) in
let l' = of_list l |> mapi (fun i x ->i,x) in
let l' = of_list l |> mapi ~f:(fun i x ->i,x) in
List.mapi (fun i x->i,x) l = to_list l'
)
*)
(*$Q
Q.(pair (list small_int)(fun2 int int bool)) (fun (l,f) -> \
mapi f (of_list l) |> to_list = List.mapi f l )
mapi ~f (of_list l) |> to_list = List.mapi f l )
*)
let rec length l = match l with
| Nil -> 0
| Cons (size,_, l') -> size + length l'
let rec iter f l = match l with
let rec iter ~f l = match l with
| Nil -> ()
| Cons (_, Leaf x, l') -> f x; iter f l'
| Cons (_, t, l') -> iter_tree t f; iter f l'
| Cons (_, Leaf x, l') -> f x; iter ~f l'
| Cons (_, t, l') -> iter_tree t f; iter ~f l'
and iter_tree t f = match t with
| Leaf x -> f x
| Node (x, t1, t2) -> f x; iter_tree t1 f; iter_tree t2 f
let iteri f l =
let iteri ~f l =
let rec aux f i l = match l with
| Nil -> ()
| Cons (size, t, l') ->
@ -184,12 +184,12 @@ let iteri f l =
in
aux f 0 l
let rec fold f acc l = match l with
let rec fold ~f ~x:acc l = match l with
| Nil -> acc
| Cons (_, Leaf x, l') -> fold f (f acc x) l'
| Cons (_, Leaf x, l') -> fold ~f ~x:(f acc x) l'
| Cons (_, t, l') ->
let acc' = fold_tree t acc f in
fold f acc' l'
fold ~f ~x:acc' l'
and fold_tree t acc f = match t with
| Leaf x -> f acc x
| Node (x, t1, t2) ->
@ -197,11 +197,11 @@ and fold_tree t acc f = match t with
let acc = fold_tree t1 acc f in
fold_tree t2 acc f
let rec fold_rev f acc l = match l with
let rec fold_rev ~f ~x:acc l = match l with
| Nil -> acc
| Cons (_, Leaf x, l') -> f (fold_rev f acc l') x
| Cons (_, Leaf x, l') -> f (fold_rev ~f ~x:acc l') x
| Cons (_, t, l') ->
let acc = fold_rev f acc l' in
let acc = fold_rev ~f ~x:acc l' in
fold_tree_rev t acc f
and fold_tree_rev t acc f = match t with
| Leaf x -> f acc x
@ -210,15 +210,15 @@ and fold_tree_rev t acc f = match t with
let acc = fold_tree_rev t1 acc f in
f acc x
let rev_map f l = fold (fun acc x -> cons (f x) acc) empty l
let rev_map ~f l = fold ~f:(fun acc x -> cons (f x) acc) ~x:empty l
(*$Q
Q.(list int) (fun l -> \
let f x = x+1 in \
of_list l |> rev_map f |> to_list = List.rev_map f l)
of_list l |> rev_map ~f |> to_list = List.rev_map f l)
*)
let rev l = fold cons' empty l
let rev l = fold ~f:cons' ~x:empty l
(*$Q
Q.(list small_int) (fun l -> \
@ -227,7 +227,7 @@ let rev l = fold cons' empty l
let l1 = of_list l in length l1 = List.length l)
*)
let append l1 l2 = fold_rev (fun l2 x -> cons x l2) l2 l1
let append l1 l2 = fold_rev ~f:(fun l2 x -> cons x l2) ~x:l2 l1
(*$Q & ~small:(CCPair.merge (CCFun.compose_binop List.length (+)))
Q.(pair (list int) (list int)) (fun (l1,l2) -> \
@ -236,27 +236,28 @@ let append l1 l2 = fold_rev (fun l2 x -> cons x l2) l2 l1
let append_tree_ t l = fold_tree_rev t l cons'
let filter p l = fold_rev (fun acc x -> if p x then cons x acc else acc) empty l
let filter ~f l =
fold_rev ~f:(fun acc x -> if f x then cons x acc else acc) ~x:empty l
let filter_map f l =
fold_rev
(fun acc x -> match f x with
let filter_map ~f l =
fold_rev ~x:empty l
~f:(fun acc x -> match f x with
| None -> acc
| Some y -> cons y acc
) empty l
)
(*$T
of_list [1;2;3;4;5;6] |> filter (fun x -> x mod 2=0) |> to_list = [2;4;6]
of_list [1;2;3;4;5;6] |> filter ~f:(fun x -> x mod 2=0) |> to_list = [2;4;6]
*)
let flat_map f l =
fold_rev
(fun acc x ->
fold_rev ~x:empty l
~f:(fun acc x ->
let l = f x in
append l acc
) empty l
)
let flatten l = fold_rev (fun acc l -> append l acc) empty l
let flatten l = fold_rev ~f:(fun acc l -> append l acc) ~x:empty l
(*$T
flatten (of_list [of_list [1]; of_list []; of_list [2;3]]) = \
@ -264,12 +265,11 @@ let flatten l = fold_rev (fun acc l -> append l acc) empty l
*)
let app funs l =
fold_rev
(fun acc f ->
fold_rev
(fun acc x -> cons (f x) acc)
acc l
) empty funs
fold_rev ~x:empty funs
~f:(fun acc f ->
fold_rev ~x:acc l
~f:(fun acc x -> cons (f x) acc)
)
(*$T
app (of_list [(+) 2; ( * ) 10]) (of_list [1;10]) |> to_list = \
@ -307,7 +307,7 @@ and take_tree_ ~size n t = match t with
take 0 (of_list CCList.(1--10)) |> to_list = []
*)
let take_while p l =
let take_while ~f l =
(* st: stack of subtrees *)
let rec aux p st = match st with
| St_nil -> Nil
@ -317,12 +317,12 @@ let take_while p l =
if p x then cons x (aux p st') else Nil
| St_tree (Node (x,l,r), st') ->
if p x then cons x (aux p (St_tree (l, St_tree (r, st')))) else Nil
in aux p (St_list (l, St_nil))
in aux f (St_list (l, St_nil))
(*$Q
Q.(list int) (fun l -> \
let f x = x mod 7 <> 0 in \
of_list l |> take_while f |> to_list = CCList.take_while f l)
of_list l |> take_while ~f |> to_list = CCList.take_while f l)
*)
let rec drop n l = match l with
@ -342,7 +342,7 @@ and drop_tree_ ~size n t tail = match t with
then drop_tree_ ~size:size' (n-1) l (append_tree_ r tail)
else drop_tree_ ~size:size' (n-1-size') r tail
let drop_while p l =
let drop_while ~f l =
let rec aux p st = match st with
| St_nil -> Nil
| St_list (Nil, st') -> aux p st'
@ -354,7 +354,7 @@ let drop_while p l =
if p x
then aux p (St_tree (l, St_tree (r, st')))
else append_tree_ tree (stack_to_list st')
in aux p (St_list (l, St_nil))
in aux f (St_list (l, St_nil))
(*$T
drop 3 (of_list CCList.(1--10)) |> to_list = CCList.(4--10)
@ -366,7 +366,7 @@ let drop_while p l =
(*$Q
Q.(list_of_size Gen.(0 -- 200) int) (fun l -> \
let f x = x mod 10 <> 0 in \
of_list l |> drop_while f |> to_list = CCList.drop_while f l)
of_list l |> drop_while ~f |> to_list = CCList.drop_while f l)
*)
let take_drop n l = take n l, drop n l
@ -441,7 +441,7 @@ let add_list l l2 = List.fold_left (fun acc x -> cons x acc) l (List.rev l2)
let of_list l = add_list empty l
let to_list l = fold_rev (fun acc x -> x :: acc) [] l
let to_list l = fold_rev ~f:(fun acc x -> x :: acc) ~x:[] l
(*$Q
Q.(list int) (fun l -> to_list (of_list l) = l)
@ -457,7 +457,7 @@ let to_array l = match l with
| Cons (_, Node (x, _,_), _) ->
let len = length l in
let arr = Array.make len x in
iteri (fun i x -> Array.set arr i x) l;
iteri ~f:(fun i x -> Array.set arr i x) l;
arr
(*$Q
@ -473,9 +473,9 @@ let of_seq s =
let add_seq l s =
let l1 = ref empty in
s (fun x -> l1 := cons x !l1);
fold (fun acc x -> cons x acc) l !l1
fold ~f:(fun acc x -> cons x acc) ~x:l !l1
let to_seq l yield = iter yield l
let to_seq l yield = iter ~f:yield l
(*$Q & ~small:List.length
Q.(list small_int) (fun l -> \
@ -495,7 +495,7 @@ let rec gen_iter_ f g = match g() with
let add_gen l g =
let l1 = ref empty in
gen_iter_ (fun x -> l1 := cons x !l1) g;
fold (fun acc x -> cons x acc) l !l1
fold ~f:(fun acc x -> cons x acc) ~x:l !l1
let of_gen g = add_gen empty g
@ -525,11 +525,11 @@ let to_gen l =
Gen.of_list l |> of_gen |> to_list = l)
*)
let rec of_list_map f l = match l with
let rec of_list_map ~f l = match l with
| [] -> empty
| x::l' ->
let y = f x in
cons y (of_list_map f l')
cons y (of_list_map ~f l')
let compare ?(cmp=Pervasives.compare) l1 l2 =
let rec cmp_gen ~cmp g1 g2 = match g1(), g2() with
@ -552,7 +552,7 @@ let compare ?(cmp=Pervasives.compare) l1 l2 =
module Infix = struct
let (@+) = cons
let (>>=) l f = flat_map f l
let (>|=) l f = map f l
let (>|=) l f = map ~f l
let (<*>) = app
let (--) = range
end
@ -565,13 +565,13 @@ type 'a printer = Format.formatter -> 'a -> unit
let print ?(sep=", ") pp_item fmt l =
let first = ref true in
iter
(fun x ->
iter l
~f:(fun x ->
if !first then first := false else (
Format.pp_print_string fmt sep;
Format.pp_print_cut fmt ();
);
pp_item fmt x
) l;
);
()

View file

@ -30,10 +30,10 @@ val cons : 'a -> 'a t -> 'a t
val return : 'a -> 'a t
(** Singleton *)
val map : ('a -> 'b) -> 'a t -> 'b t
val map : f:('a -> 'b) -> 'a t -> 'b t
(** Map on elements *)
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val mapi : f:(int -> 'a -> 'b) -> 'a t -> 'b t
(** Map with index *)
val hd : 'a t -> 'a
@ -71,9 +71,9 @@ val remove : 'a t -> int -> 'a t
val append : 'a t -> 'a t -> 'a t
val filter : ('a -> bool) -> 'a t -> 'a t
val filter : f:('a -> bool) -> 'a t -> 'a t
val filter_map : ('a -> 'b option) -> 'a t -> 'b t
val filter_map : f:('a -> 'b option) -> 'a t -> 'b t
val flat_map : ('a -> 'b t) -> 'a t -> 'b t
@ -83,28 +83,28 @@ val app : ('a -> 'b) t -> 'a t -> 'b t
val take : int -> 'a t -> 'a t
val take_while : ('a -> bool) -> 'a t -> 'a t
val take_while : f:('a -> bool) -> 'a t -> 'a t
val drop : int -> 'a t -> 'a t
val drop_while : ('a -> bool) -> 'a t -> 'a t
val drop_while : f:('a -> bool) -> 'a t -> 'a t
val take_drop : int -> 'a t -> 'a t * 'a t
(** [take_drop n l] splits [l] into [a, b] such that [length a = n]
if [length l >= n], and such that [append a b = l] *)
val iter : ('a -> unit) -> 'a t -> unit
val iter : f:('a -> unit) -> 'a t -> unit
(** Iterate on the list's elements *)
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val iteri : f:(int -> 'a -> unit) -> 'a t -> unit
val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
val fold : f:('b -> 'a -> 'b) -> x:'b -> 'a t -> 'b
(** Fold on the list's elements *)
val fold_rev : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
val fold_rev : f:('b -> 'a -> 'b) -> x:'b -> 'a t -> 'b
(** Fold on the list's elements, in reverse order (starting from the tail) *)
val rev_map : ('a -> 'b) -> 'a t -> 'b t
val rev_map : f:('a -> 'b) -> 'a t -> 'b t
(** [rev_map f l] is the same as [map f (rev l)] *)
val rev : 'a t -> 'a t
@ -137,7 +137,7 @@ val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_list_map : ('a -> 'b) -> 'a list -> 'b t
val of_list_map : f:('a -> 'b) -> 'a list -> 'b t
(** Combination of {!of_list} and {!map} *)
val of_array : 'a array -> 'a t
@ -163,8 +163,7 @@ val to_gen : 'a t -> 'a gen
module Infix : sig
val (@+) : 'a -> 'a t -> 'a t
(** Cons (alias to {!cons})
@since NEXT_RELEASE *)
(** Cons (alias to {!cons}) *)
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
(** Alias to {!flat_map} *)

View file

@ -95,16 +95,16 @@ module type S = sig
val weight : _ t -> int
val fold : ('b -> key -> 'a -> 'b) -> 'b -> 'a t -> 'b
val fold : f:('b -> key -> 'a -> 'b) -> x:'b -> 'a t -> 'b
val iter : (key -> 'a -> unit) -> 'a t -> unit
val iter : f:(key -> 'a -> unit) -> 'a t -> unit
val split : key -> 'a t -> 'a t * 'a option * 'a t
(** [split k t] returns [l, o, r] where [l] is the part of the map
with keys smaller than [k], [r] has keys bigger than [k],
and [o = Some v] if [k, v] belonged to the map *)
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
val merge : f:(key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
(** Similar to {!Map.S.merge} *)
val extract_min : 'a t -> key * 'a * 'a t
@ -361,19 +361,19 @@ module MakeFull(K : KEY) : S with type key = K.t = struct
List.for_all (fun i -> M.nth_exn i m = (i,i)) CCList.(0--1000)
*)
let rec fold f acc m = match m with
let rec fold ~f ~x:acc m = match m with
| E -> acc
| N (k, v, l, r, _) ->
let acc = fold f acc l in
let acc = fold ~f ~x:acc l in
let acc = f acc k v in
fold f acc r
fold ~f ~x:acc r
let rec iter f m = match m with
let rec iter ~f m = match m with
| E -> ()
| N (k, v, l, r, _) ->
iter f l;
iter ~f l;
f k v;
iter f r
iter ~f r
let choose_exn = function
| E -> raise Not_found
@ -459,28 +459,28 @@ module MakeFull(K : KEY) : S with type key = K.t = struct
) lst)
*)
let rec merge f a b = match a, b with
let rec merge ~f a b = match a, b with
| E, E -> E
| E, N (k, v, l, r, _) ->
let v' = f k None (Some v) in
mk_node_or_join_ k v' (merge f E l) (merge f E r)
mk_node_or_join_ k v' (merge ~f E l) (merge ~f E r)
| N (k, v, l, r, _), E ->
let v' = f k (Some v) None in
mk_node_or_join_ k v' (merge f l E) (merge f r E)
mk_node_or_join_ k v' (merge ~f l E) (merge ~f r E)
| N (k1, v1, l1, r1, w1), N (k2, v2, l2, r2, w2) ->
if K.compare k1 k2 = 0
then (* easy case *)
mk_node_or_join_ k1 (f k1 (Some v1) (Some v2))
(merge f l1 l2) (merge f r1 r2)
(merge ~f l1 l2) (merge ~f r1 r2)
else if w1 <= w2
then (* split left tree *)
let l1', v1', r1' = split k2 a in
mk_node_or_join_ k2 (f k2 v1' (Some v2))
(merge f l1' l2) (merge f r1' r2)
(merge ~f l1' l2) (merge ~f r1' r2)
else (* split right tree *)
let l2', v2', r2' = split k1 b in
mk_node_or_join_ k1 (f k1 (Some v1) v2')
(merge f l1 l2') (merge f r1 r2')
(merge ~f l1 l2') (merge ~f r1 r2')
(*$R
let m1 = M.of_list [1, 1; 2, 2; 4, 4] in
@ -504,13 +504,13 @@ module MakeFull(K : KEY) : S with type key = K.t = struct
List.for_all (fun (k,v) -> M.mem k m1 || M.get_exn k m = v) l2)
*)
let cardinal m = fold (fun acc _ _ -> acc+1) 0 m
let cardinal m = fold ~f:(fun acc _ _ -> acc+1) ~x:0 m
let add_list m l = List.fold_left (fun acc (k,v) -> add k v acc) m l
let of_list l = add_list empty l
let to_list m = fold (fun acc k v -> (k,v) :: acc) [] m
let to_list m = fold ~f:(fun acc k v -> (k,v) :: acc) ~x:[] m
let add_seq m seq =
let m = ref m in
@ -519,7 +519,7 @@ module MakeFull(K : KEY) : S with type key = K.t = struct
let of_seq s = add_seq empty s
let to_seq m yield = iter (fun k v -> yield (k,v)) m
let to_seq m yield = iter ~f:(fun k v -> yield (k,v)) m
let rec add_gen m g = match g() with
| None -> m
@ -544,14 +544,14 @@ module MakeFull(K : KEY) : S with type key = K.t = struct
let start = "[" and stop = "]" and arrow = "->" and sep = ","in
Format.pp_print_string fmt start;
let first = ref true in
iter
(fun k v ->
iter m
~f:(fun k v ->
if !first then first := false else Format.pp_print_string fmt sep;
pp_k fmt k;
Format.pp_print_string fmt arrow;
pp_v fmt v;
Format.pp_print_cut fmt ()
) m;
);
Format.pp_print_string fmt stop
end

View file

@ -61,16 +61,16 @@ module type S = sig
val weight : _ t -> int
val fold : ('b -> key -> 'a -> 'b) -> 'b -> 'a t -> 'b
val fold : f:('b -> key -> 'a -> 'b) -> x:'b -> 'a t -> 'b
val iter : (key -> 'a -> unit) -> 'a t -> unit
val iter : f:(key -> 'a -> unit) -> 'a t -> unit
val split : key -> 'a t -> 'a t * 'a option * 'a t
(** [split k t] returns [l, o, r] where [l] is the part of the map
with keys smaller than [k], [r] has keys bigger than [k],
and [o = Some v] if [k, v] belonged to the map *)
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
val merge : f:(key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
(** Similar to {!Map.S.merge} *)
val extract_min : 'a t -> key * 'a * 'a t