You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.8 KiB
74 lines
1.8 KiB
5 years ago
|
(*
|
||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
|
*
|
||
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
|
*)
|
||
|
|
||
5 years ago
|
open NS0
|
||
5 years ago
|
|
||
|
module type S = sig
|
||
|
type key
|
||
|
|
||
5 years ago
|
module Key : sig
|
||
|
type t = key
|
||
5 years ago
|
|
||
5 years ago
|
include Comparator.S with type t := t
|
||
5 years ago
|
end
|
||
5 years ago
|
|
||
5 years ago
|
include Core_kernel.Map_intf.Make_S_plain_tree(Key).S
|
||
5 years ago
|
|
||
5 years ago
|
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
|
||
5 years ago
|
val is_singleton : 'a t -> bool
|
||
5 years ago
|
|
||
5 years ago
|
val map_endo : 'a t -> f:('a -> 'a) -> 'a t
|
||
|
(** Like map, but specialized to require [f] to be an endofunction, which
|
||
|
enables preserving [==] if [f] preserves [==] of every element. *)
|
||
|
|
||
5 years ago
|
val merge_endo :
|
||
|
'a t
|
||
|
-> 'b t
|
||
|
-> f:
|
||
|
( key:key
|
||
|
-> [`Both of 'a * 'b | `Left of 'a | `Right of 'b]
|
||
|
-> 'a option)
|
||
|
-> 'a t
|
||
|
(** Like merge, but specialized to require [f] to preserve the type of the
|
||
|
left argument, which enables preserving [==] if [f] preserves [==] of
|
||
|
every element. *)
|
||
|
|
||
5 years ago
|
val merge_skewed :
|
||
|
'a t -> 'a t -> combine:(key:key -> 'a -> 'a -> 'a) -> 'a t
|
||
|
|
||
5 years ago
|
val fold_until :
|
||
|
'v t
|
||
|
-> init:'a
|
||
|
-> f:(key:key -> data:'v -> 'a -> ('a, 'r) Continue_or_stop.t)
|
||
|
-> finish:('a -> 'r)
|
||
|
-> 'r
|
||
|
|
||
5 years ago
|
val choose_exn : 'a t -> key * 'a
|
||
|
(** Find an unspecified element. [O(1)]. *)
|
||
|
|
||
5 years ago
|
val choose : 'a t -> (key * 'a) option
|
||
5 years ago
|
(** Find an unspecified element. [O(1)]. *)
|
||
|
|
||
5 years ago
|
val pop : 'a t -> (key * 'a * 'a t) option
|
||
5 years ago
|
(** Find and remove an unspecified element. [O(1)]. *)
|
||
|
|
||
|
val pop_min_elt : 'a t -> (key * 'a * 'a t) option
|
||
|
(** Find and remove minimum element. [O(log n)]. *)
|
||
|
|
||
5 years ago
|
val find_and_remove : 'a t -> key -> ('a * 'a t) option
|
||
5 years ago
|
(** Find and remove an element. *)
|
||
|
|
||
5 years ago
|
val pp : key pp -> 'a pp -> 'a t pp
|
||
5 years ago
|
|
||
5 years ago
|
val pp_diff :
|
||
|
data_equal:('a -> 'a -> bool)
|
||
|
-> key pp
|
||
|
-> 'a pp
|
||
|
-> ('a * 'a) pp
|
||
|
-> ('a t * 'a t) pp
|
||
5 years ago
|
end
|