1Depend.StringSet(3)                OCamldoc                Depend.StringSet(3)
2
3
4

NAME

6       Depend.StringSet - no description
7

Module

9       Module   Depend.StringSet
10

Documentation

12       Module StringSet
13        : sig end
14
15
16
17
18
19
20
21       type elt
22
23
24       The type of the set elements.
25
26
27       type t
28
29
30       The type of sets.
31
32
33
34       val empty : t
35
36       The empty set.
37
38
39
40       val is_empty : t -> bool
41
42       Test whether a set is empty or not.
43
44
45
46       val mem : elt -> t -> bool
47
48
49       mem x s tests whether x belongs to the set s .
50
51
52
53       val add : elt -> t -> t
54
55
56       add  x s returns a set containing all elements of s , plus x . If x was
57       already in s , s is returned unchanged (the result of the  function  is
58       then physically equal to s ).
59
60
61       Before4.03 Physical equality was not ensured.
62
63
64
65
66       val singleton : elt -> t
67
68
69       singleton x returns the one-element set containing only x .
70
71
72
73       val remove : elt -> t -> t
74
75
76       remove x s returns a set containing all elements of s , except x . If x
77       was not in s , s is returned unchanged (the result of the  function  is
78       then physically equal to s ).
79
80
81       Before4.03 Physical equality was not ensured.
82
83
84
85
86       val union : t -> t -> t
87
88       Set union.
89
90
91
92       val inter : t -> t -> t
93
94       Set intersection.
95
96
97
98       val diff : t -> t -> t
99
100       Set difference.
101
102
103
104       val compare : t -> t -> int
105
106       Total  ordering  between sets. Can be used as the ordering function for
107       doing sets of sets.
108
109
110
111       val equal : t -> t -> bool
112
113
114       equal s1 s2 tests whether the sets s1 and s2 are equal, that  is,  con‐
115       tain equal elements.
116
117
118
119       val subset : t -> t -> bool
120
121
122       subset s1 s2 tests whether the set s1 is a subset of the set s2 .
123
124
125
126       val iter : (elt -> unit) -> t -> unit
127
128
129       iter  f  s  applies f in turn to all elements of s .  The elements of s
130       are presented to f in increasing order with  respect  to  the  ordering
131       over the type of the elements.
132
133
134
135       val map : (elt -> elt) -> t -> t
136
137
138       map  f s is the set whose elements are f a0 , f a1 ...  f aN , where a0
139       , a1 ...  aN are the elements of s .
140
141       The elements are passed to f in increasing order with  respect  to  the
142       ordering over the type of the elements.
143
144       If  no element of s is changed by f , s is returned unchanged. (If each
145       output of f is physically equal to its input, the returned set is phys‐
146       ically equal to s .)
147
148
149       Since 4.04.0
150
151
152
153       val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
154
155
156       fold  f  s  a computes (f xN ... (f x2 (f x1 a))...)  , where x1 ... xN
157       are the elements of s , in increasing order.
158
159
160
161       val for_all : (elt -> bool) -> t -> bool
162
163
164       for_all p s checks if all elements of the set satisfy the predicate p .
165
166
167
168       val exists : (elt -> bool) -> t -> bool
169
170
171       exists p s checks if at least one element  of  the  set  satisfies  the
172       predicate p .
173
174
175
176       val filter : (elt -> bool) -> t -> t
177
178
179       filter  p s returns the set of all elements in s that satisfy predicate
180       p . If p satisfies every element in s , s is  returned  unchanged  (the
181       result of the function is then physically equal to s ).
182
183
184       Before4.03 Physical equality was not ensured.
185
186
187
188
189       val partition : (elt -> bool) -> t -> t * t
190
191
192       partition  p s returns a pair of sets (s1, s2) , where s1 is the set of
193       all the elements of s that satisfy the predicate p , and s2 is the  set
194       of all the elements of s that do not satisfy p .
195
196
197
198       val cardinal : t -> int
199
200       Return the number of elements of a set.
201
202
203
204       val elements : t -> elt list
205
206       Return the list of all elements of the given set.  The returned list is
207       sorted in increasing order with respect to the ordering  Ord.compare  ,
208       where Ord is the argument given to Set.Make .
209
210
211
212       val min_elt : t -> elt
213
214       Return  the  smallest  element  of  the  given set (with respect to the
215       Ord.compare ordering), or raise Not_found if the set is empty.
216
217
218
219       val min_elt_opt : t -> elt option
220
221       Return the smallest element of the  given  set  (with  respect  to  the
222       Ord.compare ordering), or None if the set is empty.
223
224
225       Since 4.05
226
227
228
229       val max_elt : t -> elt
230
231       Same  as  Set.S.min_elt  , but returns the largest element of the given
232       set.
233
234
235
236       val max_elt_opt : t -> elt option
237
238       Same as Set.S.min_elt_opt , but returns  the  largest  element  of  the
239       given set.
240
241
242       Since 4.05
243
244
245
246       val choose : t -> elt
247
248       Return  one  element of the given set, or raise Not_found if the set is
249       empty. Which element is chosen is unspecified, but equal elements  will
250       be chosen for equal sets.
251
252
253
254       val choose_opt : t -> elt option
255
256       Return one element of the given set, or None if the set is empty. Which
257       element is chosen is unspecified, but equal elements will be chosen for
258       equal sets.
259
260
261       Since 4.05
262
263
264
265       val split : elt -> t -> t * bool * t
266
267
268       split x s returns a triple (l, present, r) , where l is the set of ele‐
269       ments of s that are strictly less than x ; r is the set of elements  of
270       s  that are strictly greater than x ; present is false if s contains no
271       element equal to x , or true if s contains an element equal to x .
272
273
274
275       val find : elt -> t -> elt
276
277
278       find x s returns the element of s equal to x (according to  Ord.compare
279       ), or raise Not_found if no such element exists.
280
281
282       Since 4.01.0
283
284
285
286       val find_opt : elt -> t -> elt option
287
288
289       find_opt x s returns the element of s equal to x (according to Ord.com‐
290       pare ), or None if no such element exists.
291
292
293       Since 4.05
294
295
296
297       val find_first : (elt -> bool) -> t -> elt
298
299
300       find_first f s ,  where  f  is  a  monotonically  increasing  function,
301       returns  the  lowest element e of s such that f e , or raises Not_found
302       if no such element exists.
303
304       For example, find_first (fun e -> Ord.compare e x >= 0) s  will  return
305       the  first element e of s where Ord.compare e x >= 0 (intuitively: e >=
306       x ), or raise Not_found if x is greater than any element of s .
307
308
309       Since 4.05
310
311
312
313       val find_first_opt : (elt -> bool) -> t -> elt option
314
315
316       find_first_opt f s , where f is a  monotonically  increasing  function,
317       returns  an option containing the lowest element e of s such that f e ,
318       or None if no such element exists.
319
320
321       Since 4.05
322
323
324
325       val find_last : (elt -> bool) -> t -> elt
326
327
328       find_last f s , where f is a monotonically decreasing function, returns
329       the  highest  element  e of s such that f e , or raises Not_found if no
330       such element exists.
331
332
333       Since 4.05
334
335
336
337       val find_last_opt : (elt -> bool) -> t -> elt option
338
339
340       find_last_opt f s , where f is  a  monotonically  decreasing  function,
341       returns an option containing the highest element e of s such that f e ,
342       or None if no such element exists.
343
344
345       Since 4.05
346
347
348
349       val of_list : elt list -> t
350
351
352       of_list l creates a set from a list of elements.  This is usually  more
353       efficient than folding add over the list, except perhaps for lists with
354       many duplicated elements.
355
356
357       Since 4.02.0
358
359
360
361
362
3632018-04-14                          source:                Depend.StringSet(3)
Impressum