1Weak.Make(3)                     OCaml library                    Weak.Make(3)
2
3
4

NAME

6       Weak.Make  -  Functor building an implementation of the weak hash table
7       structure.
8

Module

10       Module   Weak.Make
11

Documentation

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