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

NAME

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