-
Notifications
You must be signed in to change notification settings - Fork 8
/
trie.mli
59 lines (43 loc) · 2.19 KB
/
trie.mli
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
(**************************************************************************)
(* *)
(* Cubicle *)
(* *)
(* Copyright (C) 2011-2014 *)
(* *)
(* Sylvain Conchon and Alain Mebsout *)
(* Universite Paris-Sud 11 *)
(* *)
(* *)
(* This file is distributed under the terms of the Apache Software *)
(* License version 2.0 *)
(* *)
(**************************************************************************)
module type OrderedType = sig
type t
val compare : t -> t -> int
end
module Make ( X : OrderedType ) : sig
type 'a t
val empty : 'a t
(** The empty trie. *)
val is_empty : 'a t -> bool
(** Test emptyness of a trie *)
val add : X.t list -> 'a -> 'a t -> 'a t
(** Add a mapping cube->v to trie *)
val add_force : X.t list -> 'a -> 'a t -> 'a t
(** Add a mapping cube->v to trie without checking for subsomption *)
val mem : X.t list -> 'a t -> 'a option
(** Is cube subsumed by some cube in the trie? *)
val iter : ('a -> unit) -> 'a t -> unit
(** Apply f to all values mapped to in the trie. *)
val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
(** fold f to all values mapped to in the trie. *)
val delete : ('a -> bool) -> 'a t -> 'a t
(** Delete all values which satisfy the predicate p *)
val iter_sub : ('a -> unit) -> X.t list -> 'a t -> unit
(** Apply f to all values whose keys (cubes) are subsumed by the given cube. *)
val all_vals : 'a t -> 'a list
(** List of all values mapped by the trie *)
val iter_nodes : (X.t -> unit) -> 'a t -> unit
val forall_exists : (X.t -> bool) -> 'a t -> bool
end