blob: f48465126c66b2936aa349abbd1d0ab207073198 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
module type KEY = sig
type t
val compare : t -> t -> int
val pp : Format.formatter -> t -> unit
end
module Make (El : KEY) : sig
type 'a t
val empty : unit -> 'a t
(** Create an empty tree *)
val isEmpty : 'a t -> bool
val find : El.t -> 'a t -> 'a option
(** Return the element in the tree with the given key *)
val add : El.t -> 'a -> 'a t -> 'a t
(** Add one element in the tree, if the key is already present, the associated
element is replaced. *)
val member : El.t -> 'a t -> bool
(** Check if the key exists *)
val remove : El.t -> 'a t -> 'a t
val fold : ('a -> El.t * 'b -> 'a) -> 'a -> 'b t -> 'a
val choose : 'a t -> (El.t * 'a) option
(** Return one element of the given tree, or raise Not_found if the tree is
empty. Which element is chosen is unspecified, but equal elements will be
chosen for equal trees. *)
val pp : Format.formatter -> 'a t -> unit
(** Represent the content in dot syntax *)
end
|