1Weak.S(3)                          OCamldoc                          Weak.S(3)
2
3
4

NAME

6       Weak.S - The output signature of the functor Weak.Make.
7

Module type

9       Module type   Weak.S
10

Documentation

12       Module type S
13        = sig end
14
15
16       The output signature of the functor Weak.Make .
17
18
19
20
21
22       type data
23
24
25       The type of the elements stored in the table.
26
27
28       type t
29
30
31       The type of tables that contain elements of type data .  Note that weak
32       hash sets cannot be  marshaled  using  Pervasives.output_value  or  the
33       functions of the Marshal module.
34
35
36
37       val create : int -> t
38
39
40       create  n  creates  a new empty weak hash set, of initial size n .  The
41       table will grow as needed.
42
43
44
45       val clear : t -> unit
46
47       Remove all elements from the table.
48
49
50
51       val merge : t -> data -> data
52
53
54       merge t x returns an instance of x found in t if any, or else adds x to
55       t and return x .
56
57
58
59       val add : t -> data -> unit
60
61
62       add  t  x adds x to t .  If there is already an instance of x in t , it
63       is unspecified which one will be returned by subsequent calls  to  find
64       and merge .
65
66
67
68       val remove : t -> data -> unit
69
70
71       remove t x removes from t one instance of x .  Does nothing if there is
72       no instance of x in t .
73
74
75
76       val find : t -> data -> data
77
78
79       find t x returns an instance of x found in  t  .   Raise  Not_found  if
80       there is no such element.
81
82
83
84       val find_opt : t -> data -> data option
85
86
87       find_opt t x returns an instance of x found in t or None if there is no
88       such element.
89
90
91       Since 4.05
92
93
94
95       val find_all : t -> data -> data list
96
97
98       find_all t x returns a list of all the instances of x found in t .
99
100
101
102       val mem : t -> data -> bool
103
104
105       mem t x returns true if there is at least one instance  of  x  in  t  ,
106       false otherwise.
107
108
109
110       val iter : (data -> unit) -> t -> unit
111
112
113       iter  f t calls f on each element of t , in some unspecified order.  It
114       is not specified what happens if f tries to change t itself.
115
116
117
118       val fold : (data -> 'a -> 'a) -> t -> 'a -> 'a
119
120
121       fold f t init computes (f d1 (... (f dN init))) where d1 ... dN are the
122       elements of t in some unspecified order.  It is not specified what hap‐
123       pens if f tries to change t itself.
124
125
126
127       val count : t -> int
128
129       Count the number of elements in the table.   count  t  gives  the  same
130       result as fold (fun _ n -> n+1) t 0 but does not delay the deallocation
131       of the dead elements.
132
133
134
135       val stats : t -> int * int * int * int * int * int
136
137       Return statistics on the table.   The  numbers  are,  in  order:  table
138       length,  number  of  entries,  sum  of  bucket lengths, smallest bucket
139       length, median bucket length, biggest bucket length.
140
141
142
143
144
1452018-04-14                          source:                          Weak.S(3)
Impressum