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_set(Set) -> boolean()
106
107 Types:
108
109 Set = term()
110
111 Returns true if Set is a set of elements, otherwise false.
112
113 is_subset(Set1, Set2) -> boolean()
114
115 Types:
116
117 Set1 = Set2 = set(Element)
118
119 Returns true when every element of Set1 is also a member of
120 Set2, otherwise false.
121
122 new() -> set()
123
124 Returns a new empty set.
125
126 size(Set) -> integer() >= 0
127
128 Types:
129
130 Set = set()
131
132 Returns the number of elements in Set.
133
134 subtract(Set1, Set2) -> Set3
135
136 Types:
137
138 Set1 = Set2 = Set3 = set(Element)
139
140 Returns only the elements of Set1 that are not also elements of
141 Set2.
142
143 to_list(Set) -> List
144
145 Types:
146
147 Set = set(Element)
148 List = [Element]
149
150 Returns the elements of Set as a list. The order of the returned
151 elements is undefined.
152
153 union(SetList) -> Set
154
155 Types:
156
157 SetList = [set(Element)]
158 Set = set(Element)
159
160 Returns the merged (union) set of the list of sets.
161
162 union(Set1, Set2) -> Set3
163
164 Types:
165
166 Set1 = Set2 = Set3 = set(Element)
167
168 Returns the merged (union) set of Set1 and Set2.
169
171 gb_sets(3), ordsets(3)
172
173
174
175Ericsson AB stdlib 3.4.5.1 sets(3)