1Set.S(3)                         OCaml library                        Set.S(3)
2
3
4

NAME

6       Set.S - Output signature of the functor Set.Make.
7

Module type

9       Module type   Set.S
10

Documentation

12       Module type S
13        = sig end
14
15
16       Output signature of the functor Set.Make .
17
18
19
20
21
22
23       type elt
24
25
26       The type of the set elements.
27
28
29
30       type t
31
32
33       The type of sets.
34
35
36
37
38       val empty : t
39
40       The empty set.
41
42
43
44
45       val is_empty : t -> bool
46
47       Test whether a set is empty or not.
48
49
50
51
52       val mem : elt -> t -> bool
53
54
55       mem x s tests whether x belongs to the set s .
56
57
58
59
60       val add : elt -> t -> t
61
62
63       add  x s returns a set containing all elements of s , plus x . If x was
64       already in s , s is returned unchanged.
65
66
67
68
69       val singleton : elt -> t
70
71
72       singleton x returns the one-element set containing only x .
73
74
75
76
77       val remove : elt -> t -> t
78
79
80       remove x s returns a set containing all elements of s , except x . If x
81       was not in s , s is returned unchanged.
82
83
84
85
86       val union : t -> t -> t
87
88       Set union.
89
90
91
92
93       val inter : t -> t -> t
94
95       Set intersection.
96
97
98
99
100       val diff : t -> t -> t
101
102       Set difference.
103
104
105
106
107       val compare : t -> t -> int
108
109       Total  ordering  between sets. Can be used as the ordering function for
110       doing sets of sets.
111
112
113
114
115       val equal : t -> t -> bool
116
117
118       equal s1 s2 tests whether the sets s1 and s2 are equal, that  is,  con‐
119       tain equal elements.
120
121
122
123
124       val subset : t -> t -> bool
125
126
127       subset s1 s2 tests whether the set s1 is a subset of the set s2 .
128
129
130
131
132       val iter : (elt -> unit) -> t -> unit
133
134
135       iter  f  s  applies f in turn to all elements of s .  The elements of s
136       are presented to f in increasing order with  respect  to  the  ordering
137       over the type of the elements.
138
139
140
141
142       val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
143
144
145       fold  f  s  a computes (f xN ... (f x2 (f x1 a))...)  , where x1 ... xN
146       are the elements of s , in increasing order.
147
148
149
150
151       val for_all : (elt -> bool) -> t -> bool
152
153
154       for_all p s checks if all elements of the set satisfy the predicate p .
155
156
157
158
159       val exists : (elt -> bool) -> t -> bool
160
161
162       exists p s checks if at least one element  of  the  set  satisfies  the
163       predicate p .
164
165
166
167
168       val filter : (elt -> bool) -> t -> t
169
170
171       filter  p s returns the set of all elements in s that satisfy predicate
172       p .
173
174
175
176
177       val partition : (elt -> bool) -> t -> t * t
178
179
180       partition p s returns a pair of sets (s1, s2) , where s1 is the set  of
181       all  the elements of s that satisfy the predicate p , and s2 is the set
182       of all the elements of s that do not satisfy p .
183
184
185
186
187       val cardinal : t -> int
188
189       Return the number of elements of a set.
190
191
192
193
194       val elements : t -> elt list
195
196       Return the list of all elements of the given set.  The returned list is
197       sorted  in  increasing order with respect to the ordering Ord.compare ,
198       where Ord is the argument given to Set.Make .
199
200
201
202
203       val min_elt : t -> elt
204
205       Return the smallest element of the  given  set  (with  respect  to  the
206       Ord.compare ordering), or raise Not_found if the set is empty.
207
208
209
210
211       val max_elt : t -> elt
212
213       Same  as  Set.S.min_elt  , but returns the largest element of the given
214       set.
215
216
217
218
219       val choose : t -> elt
220
221       Return one element of the given set, or raise Not_found if the  set  is
222       empty.  Which element is chosen is unspecified, but equal elements will
223       be chosen for equal sets.
224
225
226
227
228       val split : elt -> t -> t * bool * t
229
230
231       split x s returns a triple (l, present, r) , where l is the set of ele‐
232       ments  of s that are strictly less than x ; r is the set of elements of
233       s that are strictly greater than x ; present is false if s contains  no
234       element equal to x , or true if s contains an element equal to x .
235
236
237
238
239
240
241OCamldoc                          2017-03-22                          Set.S(3)
Impressum