File: sets.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (263 lines) | stat: -rw-r--r-- 3,425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
.TH sets 3 "stdlib  1.15.3" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
sets \- Functions for Set Manipulation
.SH DESCRIPTION
.LP
Sets are collections of elements with no duplicate elements\&. The representation of a set is not defined\&.
.LP
This module provides exactly the same interface as the module \fIordsets\fR but with a defined representation\&. One difference is that while this module considers two elements as different if they do not match (\fI=:=\fR), \fIordsets\fR considers two elements as different if and only if they do not compare equal (\fI==\fR)\&.

.SH DATA TYPES

.nf
set()
  as returned by new/0
.fi
.SH EXPORTS
.LP
.B
new() -> Set
.br
.RS
.TP
Types
Set = set()
.br
.RE
.RS
.LP
Returns a new empty set\&.
.RE
.LP
.B
is_set(Set) -> bool()
.br
.RS
.TP
Types
Set = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fISet\fR is a set of elements, otherwise \fIfalse\fR\&.
.RE
.LP
.B
size(Set) -> int()
.br
.RS
.TP
Types
Set = term()
.br
.RE
.RS
.LP
Returns the number of elements in \fISet\fR\&.
.RE
.LP
.B
to_list(Set) -> List
.br
.RS
.TP
Types
Set = set()
.br
List = [term()]
.br
.RE
.RS
.LP
Returns the elements of \fISet\fR as a list\&.
.RE
.LP
.B
from_list(List) -> Set
.br
.RS
.TP
Types
List = [term()]
.br
Set = set()
.br
.RE
.RS
.LP
Returns an set of the elements in \fIList\fR\&.
.RE
.LP
.B
is_element(Element, Set) -> bool()
.br
.RS
.TP
Types
Element = term()
.br
Set = set()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fIElement\fR is an element of \fISet\fR, otherwise \fIfalse\fR\&.
.RE
.LP
.B
add_element(Element, Set1) -> Set2
.br
.RS
.TP
Types
Element = term()
.br
Set1 = Set2 = set()
.br
.RE
.RS
.LP
Returns a new set formed from \fISet1\fR with \fIElement\fR inserted\&.
.RE
.LP
.B
del_element(Element, Set1) -> Set2
.br
.RS
.TP
Types
Element = term()
.br
Set1 = Set2 = set()
.br
.RE
.RS
.LP
Returns \fISet1\fR, but with \fIElement\fR removed\&.
.RE
.LP
.B
union(Set1, Set2) -> Set3
.br
.RS
.TP
Types
Set1 = Set2 = Set3 = set()
.br
.RE
.RS
.LP
Returns the merged (union) set of \fISet1\fR and \fISet2\fR\&.
.RE
.LP
.B
union(SetList) -> Set
.br
.RS
.TP
Types
SetList = [set()]
.br
Set = set()
.br
.RE
.RS
.LP
Returns the merged (union) set of the list of sets\&.
.RE
.LP
.B
intersection(Set1, Set2) -> Set3
.br
.RS
.TP
Types
Set1 = Set2 = Set3 = set()
.br
.RE
.RS
.LP
Returns the intersection of \fISet1\fR and \fISet2\fR\&.
.RE
.LP
.B
intersection(SetList) -> Set
.br
.RS
.TP
Types
SetList = [set()]
.br
Set = set()
.br
.RE
.RS
.LP
Returns the intersection of the non-empty list of sets\&.
.RE
.LP
.B
subtract(Set1, Set2) -> Set3
.br
.RS
.TP
Types
Set1 = Set2 = Set3 = set()
.br
.RE
.RS
.LP
Returns only the elements of \fISet1\fR which are not also elements of \fISet2\fR\&.
.RE
.LP
.B
is_subset(Set1, Set2) -> bool()
.br
.RS
.TP
Types
Set1 = Set2 = set()
.br
.RE
.RS
.LP
Returns \fItrue\fR when every element of \fISet\fR1 is also a member of \fISet2\fR, otherwise \fIfalse\fR\&.
.RE
.LP
.B
fold(Function, Acc0, Set) -> Acc1
.br
.RS
.TP
Types
Function = fun (E, AccIn) -> AccOut
.br
Acc0 = Acc1 = AccIn = AccOut = term()
.br
Set = set()
.br
.RE
.RS
.LP
Fold \fIFunction\fR over every element in \fISet\fR returning the final value of the accumulator\&.
.RE
.LP
.B
filter(Pred, Set1) -> Set2
.br
.RS
.TP
Types
Pred = fun (E) -> bool()
.br
Set1 = Set2 = set()
.br
.RE
.RS
.LP
Filter elements in \fISet1\fR with boolean function \fIFun\fR\&.
.RE
.SH SEE ALSO
.LP
ordsets(3), gb_sets(3)