1sets(3) Erlang Module Definition sets(3)
2
3
4
6 sets - Functions for set manipulation.
7
9 Sets are collections of elements with no duplicate elements. The repreā
10 sentation of a set is undefined.
11
12 This module provides the same interface as the ordsets(3) module but
13 with an undefined representation. One difference is that while this
14 module considers two elements as different if they do not match (=:=),
15 ordsets considers two elements as different if and only if they do not
16 compare equal (==).
17
19 set(Element)
20
21 As returned by new/0.
22
23 set() = set(term())
24
26 add_element(Element, Set1) -> Set2
27
28 Types:
29
30 Set1 = Set2 = set(Element)
31
32 Returns a new set formed from Set1 with Element inserted.
33
34 del_element(Element, Set1) -> Set2
35
36 Types:
37
38 Set1 = Set2 = set(Element)
39
40 Returns Set1, but with Element removed.
41
42 filter(Pred, Set1) -> Set2
43
44 Types:
45
46 Pred = fun((Element) -> boolean())
47 Set1 = Set2 = set(Element)
48
49 Filters elements in Set1 with boolean function Pred.
50
51 fold(Function, Acc0, Set) -> Acc1
52
53 Types:
54
55 Function = fun((Element, AccIn) -> AccOut)
56 Set = set(Element)
57 Acc0 = Acc1 = AccIn = AccOut = Acc
58
59 Folds Function over every element in Set and returns the final
60 value of the accumulator. The evaluation order is undefined.
61
62 from_list(List) -> Set
63
64 Types:
65
66 List = [Element]
67 Set = set(Element)
68
69 Returns a set of the elements in List.
70
71 intersection(SetList) -> Set
72
73 Types:
74
75 SetList = [set(Element), ...]
76 Set = set(Element)
77
78 Returns the intersection of the non-empty list of sets.
79
80 intersection(Set1, Set2) -> Set3
81
82 Types:
83
84 Set1 = Set2 = Set3 = set(Element)
85
86 Returns the intersection of Set1 and Set2.
87
88 is_disjoint(Set1, Set2) -> boolean()
89
90 Types:
91
92 Set1 = Set2 = set(Element)
93
94 Returns true if Set1 and Set2 are disjoint (have no elements in
95 common), otherwise false.
96
97 is_element(Element, Set) -> boolean()
98
99 Types:
100
101 Set = set(Element)
102
103 Returns true if Element is an element of Set, otherwise false.
104
105 is_empty(Set) -> boolean()
106
107 Types:
108
109 Set = set()
110
111 Returns true if Set is an empty set, otherwise false.
112
113 is_set(Set) -> boolean()
114
115 Types:
116
117 Set = term()
118
119 Returns true if Set is a set of elements, otherwise false.
120
121 is_subset(Set1, Set2) -> boolean()
122
123 Types:
124
125 Set1 = Set2 = set(Element)
126
127 Returns true when every element of Set1 is also a member of
128 Set2, otherwise false.
129
130 new() -> set()
131
132 Returns a new empty set.
133
134 size(Set) -> integer() >= 0
135
136 Types:
137
138 Set = set()
139
140 Returns the number of elements in Set.
141
142 subtract(Set1, Set2) -> Set3
143
144 Types:
145
146 Set1 = Set2 = Set3 = set(Element)
147
148 Returns only the elements of Set1 that are not also elements of
149 Set2.
150
151 to_list(Set) -> List
152
153 Types:
154
155 Set = set(Element)
156 List = [Element]
157
158 Returns the elements of Set as a list. The order of the returned
159 elements is undefined.
160
161 union(SetList) -> Set
162
163 Types:
164
165 SetList = [set(Element)]
166 Set = set(Element)
167
168 Returns the merged (union) set of the list of sets.
169
170 union(Set1, Set2) -> Set3
171
172 Types:
173
174 Set1 = Set2 = Set3 = set(Element)
175
176 Returns the merged (union) set of Set1 and Set2.
177
179 gb_sets(3), ordsets(3)
180
181
182
183Ericsson AB stdlib 3.8.2.1 sets(3)