File: sets.html

package info (click to toggle)
erlang-doc-html 1%3A8.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 18,028 kB
  • ctags: 7,419
  • sloc: perl: 1,841; ansic: 323; erlang: 155
file content (202 lines) | stat: -rw-r--r-- 5,593 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
<HTML>
<HEAD>
<!-- refpage -->
<TITLE>sets</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>


<A HREF="http://www.erlang.se"><IMG BORDER=0 ALT="[Erlang Systems]" SRC="min_head.gif"></A>
<H1>sets</H1>
</CENTER>
<H3>MODULE</H3>
<UL>
sets</UL>
<H3>MODULE SUMMARY</H3>
<UL>
Functions for Set Manipulation
</UL>
<H3>DESCRIPTION</H3>
<UL>
<P>Sets are collections of elements with no duplicate elements.
The representation of a set is not defined.
</UL>
<H3>EXPORTS</H3>
<P><A NAME="new%0"><STRONG><CODE>new() -&#62; Set</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Set = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns a new empty ordered set.
</UL>
<P><A NAME="is_set%1"><STRONG><CODE>is_set(Set) -&#62; bool()</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Set = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns <CODE>true</CODE> if <CODE>Set</CODE> is an ordered set of
elements, otherwise <CODE>false</CODE>.
</UL>
<P><A NAME="size%1"><STRONG><CODE>size(Set) -&#62; int()</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Set = term()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the number of elements in <CODE>Set</CODE>.
</UL>
<P><A NAME="to_list%1"><STRONG><CODE>to_list(Set) -&#62; List</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Set = set()</CODE></STRONG><BR>
<STRONG><CODE>List = [term()]</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the elements of <CODE>Set</CODE> as a list.
</UL>
<P><A NAME="from_list%1"><STRONG><CODE>from_list(List) -&#62; Set</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>List = [term()]</CODE></STRONG><BR>
<STRONG><CODE>Set = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns an ordered set of the elements in <CODE>List</CODE>.
</UL>
<P><A NAME="is_element%2"><STRONG><CODE>is_element(Element, Set) -&#62; bool()</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Element = term()</CODE></STRONG><BR>
<STRONG><CODE>Set = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns <CODE>true</CODE> if <CODE>Element</CODE> is an element of
<CODE>Set</CODE>, otherwise <CODE>false</CODE>.
</UL>
<P><A NAME="add_element%2"><STRONG><CODE>add_element(Element, Set1) -&#62; Set2</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Element = term()</CODE></STRONG><BR>
<STRONG><CODE>Set1 = Set2 = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns a new ordered set formed from <CODE>Set1</CODE> with
<CODE>Element</CODE> inserted.
</UL>
<P><A NAME="del_element%2"><STRONG><CODE>del_element(Element, Set1) -&#62; Set2</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Element = term()</CODE></STRONG><BR>
<STRONG><CODE>Set1 = Set2 = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns <CODE>Set1</CODE>, but with <CODE>Element</CODE> removed.
</UL>
<P><A NAME="union%2"><STRONG><CODE>union(Set1, Set2) -&#62; Set3</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Set1 = Set2 = Set3 = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the merged (union) set of <CODE>Set1</CODE> and
<CODE>Set2</CODE>.
</UL>
<P><A NAME="union%1"><STRONG><CODE>union(SetList) -&#62; Set</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>SetList = [set()]</CODE></STRONG><BR>
<STRONG><CODE>Set = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the merged (union) set of the list of sets.
</UL>
<P><A NAME="intersection%2"><STRONG><CODE>intersection(Set1, Set2) -&#62; Set3</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Set1 = Set2 = Set3 = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the intersection of <CODE>Set1</CODE> and
<CODE>Set2</CODE>.
</UL>
<P><A NAME="intersection%1"><STRONG><CODE>intersection(SetList) -&#62; Set</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>SetList = [set()]</CODE></STRONG><BR>
<STRONG><CODE>Set = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns the intersection of the non-empty list of sets.
</UL>
<P><A NAME="subtract%2"><STRONG><CODE>subtract(Set1, Set2) -&#62; Set3</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Set1 = Set2 = Set3 = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns only the elements of <CODE>Set1</CODE> which are not
also elements of <CODE>Set2</CODE>.
</UL>
<P><A NAME="is_subset%2"><STRONG><CODE>is_subset(Set1, Set2) -&#62; bool()</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Set1 = Set2 = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Returns <CODE>true</CODE> when every element of <CODE>Set</CODE>1 is
also a member of <CODE>Set2</CODE>, otherwise <CODE>false</CODE>.
</UL>
<P><A NAME="fold%3"><STRONG><CODE>fold(Function, Acc0, Set) -&#62; Acc1</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Function = fun (E, AccIn) -&#62; AccOut</CODE></STRONG><BR>
<STRONG><CODE>Acc0 = Acc1 = AccIn = AccOut = term()</CODE></STRONG><BR>
<STRONG><CODE>Set = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Fold <CODE>Function</CODE> over every element in <CODE>Set</CODE>
returning the final value of the accumulator.
</UL>
<P><A NAME="filter%2"><STRONG><CODE>filter(Pred, Set1) -&#62; Set2</CODE></STRONG></A><BR>
<P><UL>Types:
<UL>
<STRONG><CODE>Pred = fun (E) -&#62; bool()</CODE></STRONG><BR>
<STRONG><CODE>Set1 = Set2 = set()</CODE></STRONG><BR>
</UL>
</UL>
<UL>
<P>Filter elements in <CODE>Set1</CODE> with boolean function
<CODE>Fun</CODE>.
</UL>
<H3>AUTHORS</H3>
<UL>
Robert Virding - support@erlang.ericsson.se<BR>
</UL>
<CENTER>
<HR>
<FONT SIZE=-1>stdlib 1.10<BR>
Copyright &copy; 1991-2001
<A HREF="http://www.erlang.se">Ericsson Utvecklings AB</A><BR>
<!--#include virtual="/ssi/otp_footer.html"-->
</FONT>
</CENTER>
</BODY>
</HTML>