~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/stdlib/doc/src/sets.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE erlref SYSTEM "erlref.dtd">
 
3
 
 
4
<erlref>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>2000</year>
 
8
      <year>2007</year>
 
9
      <holder>Ericsson AB, All Rights Reserved</holder>
 
10
    </copyright>
 
11
    <legalnotice>
 
12
  The contents of this file are subject to the Erlang Public License,
 
13
  Version 1.1, (the "License"); you may not use this file except in
 
14
  compliance with the License. You should have received a copy of the
 
15
  Erlang Public License along with this software. If not, it can be
 
16
  retrieved online at http://www.erlang.org/.
 
17
 
 
18
  Software distributed under the License is distributed on an "AS IS"
 
19
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
20
  the License for the specific language governing rights and limitations
 
21
  under the License.
 
22
 
 
23
  The Initial Developer of the Original Code is Ericsson AB.
 
24
    </legalnotice>
 
25
 
 
26
    <title>sets</title>
 
27
    <prepared>Robert Virding</prepared>
 
28
    <responsible>Bjarne Dacker</responsible>
 
29
    <docno>1</docno>
 
30
    <approved>Bjarne D&auml;cker</approved>
 
31
    <checked></checked>
 
32
    <date>99-07-27</date>
 
33
    <rev>A</rev>
 
34
    <file>sets.sgml</file>
 
35
  </header>
 
36
  <module>sets</module>
 
37
  <modulesummary>Functions for Set Manipulation</modulesummary>
 
38
  <description>
 
39
    <p>Sets are collections of elements with no duplicate elements.
 
40
      The representation of a set is not defined.</p>
 
41
    <p>This module provides exactly the same interface as the module
 
42
      <c>ordsets</c> but with a defined representation. One difference is
 
43
      that while this module considers two elements as different if they
 
44
      do not match (<c>=:=</c>), <c>ordsets</c> considers two elements as
 
45
      different if and only if they do not compare equal (<c>==</c>).</p>
 
46
  </description>
 
47
 
 
48
  <section>
 
49
    <title>DATA TYPES</title>
 
50
    <code type="none">
 
51
set()
 
52
  as returned by new/0</code>
 
53
  </section>
 
54
  <funcs>
 
55
    <func>
 
56
      <name>new() -> Set</name>
 
57
      <fsummary>Return an empty set</fsummary>
 
58
      <type>
 
59
        <v>Set = set()</v>
 
60
      </type>
 
61
      <desc>
 
62
        <p>Returns a new empty set.</p>
 
63
      </desc>
 
64
    </func>
 
65
    <func>
 
66
      <name>is_set(Set) -> bool()</name>
 
67
      <fsummary>Test for an <c>Set</c></fsummary>
 
68
      <type>
 
69
        <v>Set = term()</v>
 
70
      </type>
 
71
      <desc>
 
72
        <p>Returns <c>true</c> if <c>Set</c> is a set of
 
73
          elements, otherwise <c>false</c>.</p>
 
74
      </desc>
 
75
    </func>
 
76
    <func>
 
77
      <name>size(Set) -> int()</name>
 
78
      <fsummary>Return the number of elements in a set</fsummary>
 
79
      <type>
 
80
        <v>Set = term()</v>
 
81
      </type>
 
82
      <desc>
 
83
        <p>Returns the number of elements in <c>Set</c>.</p>
 
84
      </desc>
 
85
    </func>
 
86
    <func>
 
87
      <name>to_list(Set) -> List</name>
 
88
      <fsummary>Convert an <c>Set</c>into a list</fsummary>
 
89
      <type>
 
90
        <v>Set = set()</v>
 
91
        <v>List = [term()]</v>
 
92
      </type>
 
93
      <desc>
 
94
        <p>Returns the elements of <c>Set</c> as a list.</p>
 
95
      </desc>
 
96
    </func>
 
97
    <func>
 
98
      <name>from_list(List) -> Set</name>
 
99
      <fsummary>Convert a list into an <c>Set</c></fsummary>
 
100
      <type>
 
101
        <v>List = [term()]</v>
 
102
        <v>Set = set()</v>
 
103
      </type>
 
104
      <desc>
 
105
        <p>Returns an set of the elements in <c>List</c>.</p>
 
106
      </desc>
 
107
    </func>
 
108
    <func>
 
109
      <name>is_element(Element, Set) -> bool()</name>
 
110
      <fsummary>Test for membership of an <c>Set</c></fsummary>
 
111
      <type>
 
112
        <v>Element = term()</v>
 
113
        <v>Set = set()</v>
 
114
      </type>
 
115
      <desc>
 
116
        <p>Returns <c>true</c> if <c>Element</c> is an element of
 
117
          <c>Set</c>, otherwise <c>false</c>.</p>
 
118
      </desc>
 
119
    </func>
 
120
    <func>
 
121
      <name>add_element(Element, Set1) -> Set2</name>
 
122
      <fsummary>Add an element to an <c>Set</c></fsummary>
 
123
      <type>
 
124
        <v>Element = term()</v>
 
125
        <v>Set1 = Set2 = set()</v>
 
126
      </type>
 
127
      <desc>
 
128
        <p>Returns a new set formed from <c>Set1</c> with
 
129
          <c>Element</c> inserted.</p>
 
130
      </desc>
 
131
    </func>
 
132
    <func>
 
133
      <name>del_element(Element, Set1) -> Set2</name>
 
134
      <fsummary>Remove an element from an <c>Set</c></fsummary>
 
135
      <type>
 
136
        <v>Element = term()</v>
 
137
        <v>Set1 = Set2 = set()</v>
 
138
      </type>
 
139
      <desc>
 
140
        <p>Returns <c>Set1</c>, but with <c>Element</c> removed.</p>
 
141
      </desc>
 
142
    </func>
 
143
    <func>
 
144
      <name>union(Set1, Set2) -> Set3</name>
 
145
      <fsummary>Return the union of two <c>Sets</c></fsummary>
 
146
      <type>
 
147
        <v>Set1 = Set2 = Set3 = set()</v>
 
148
      </type>
 
149
      <desc>
 
150
        <p>Returns the merged (union) set of <c>Set1</c> and
 
151
          <c>Set2</c>.</p>
 
152
      </desc>
 
153
    </func>
 
154
    <func>
 
155
      <name>union(SetList) -> Set</name>
 
156
      <fsummary>Return the union of a list of <c>Sets</c></fsummary>
 
157
      <type>
 
158
        <v>SetList = [set()]</v>
 
159
        <v>Set = set()</v>
 
160
      </type>
 
161
      <desc>
 
162
        <p>Returns the merged (union) set of the list of sets.</p>
 
163
      </desc>
 
164
    </func>
 
165
    <func>
 
166
      <name>intersection(Set1, Set2) -> Set3</name>
 
167
      <fsummary>Return the intersection of two <c>Sets</c></fsummary>
 
168
      <type>
 
169
        <v>Set1 = Set2 = Set3 = set()</v>
 
170
      </type>
 
171
      <desc>
 
172
        <p>Returns the intersection of <c>Set1</c> and
 
173
          <c>Set2</c>.</p>
 
174
      </desc>
 
175
    </func>
 
176
    <func>
 
177
      <name>intersection(SetList) -> Set</name>
 
178
      <fsummary>Return the intersection of a list of <c>Sets</c></fsummary>
 
179
      <type>
 
180
        <v>SetList = [set()]</v>
 
181
        <v>Set = set()</v>
 
182
      </type>
 
183
      <desc>
 
184
        <p>Returns the intersection of the non-empty list of sets.</p>
 
185
      </desc>
 
186
    </func>
 
187
    <func>
 
188
      <name>subtract(Set1, Set2) -> Set3</name>
 
189
      <fsummary>Return the difference of two <c>Sets</c></fsummary>
 
190
      <type>
 
191
        <v>Set1 = Set2 = Set3 = set()</v>
 
192
      </type>
 
193
      <desc>
 
194
        <p>Returns only the elements of <c>Set1</c> which are not
 
195
          also elements of <c>Set2</c>.</p>
 
196
      </desc>
 
197
    </func>
 
198
    <func>
 
199
      <name>is_subset(Set1, Set2) -> bool()</name>
 
200
      <fsummary>Test for subset</fsummary>
 
201
      <type>
 
202
        <v>Set1 = Set2 = set()</v>
 
203
      </type>
 
204
      <desc>
 
205
        <p>Returns <c>true</c> when every element of <c>Set</c>1 is
 
206
          also a member of <c>Set2</c>, otherwise <c>false</c>.</p>
 
207
      </desc>
 
208
    </func>
 
209
    <func>
 
210
      <name>fold(Function, Acc0, Set) -> Acc1</name>
 
211
      <fsummary>Fold over set elements</fsummary>
 
212
      <type>
 
213
        <v>Function = fun (E, AccIn) -> AccOut</v>
 
214
        <v>Acc0 = Acc1 = AccIn = AccOut = term()</v>
 
215
        <v>Set = set()</v>
 
216
      </type>
 
217
      <desc>
 
218
        <p>Fold <c>Function</c> over every element in <c>Set</c>
 
219
          returning the final value of the accumulator.</p>
 
220
      </desc>
 
221
    </func>
 
222
    <func>
 
223
      <name>filter(Pred, Set1) -> Set2</name>
 
224
      <fsummary>Filter set elements</fsummary>
 
225
      <type>
 
226
        <v>Pred = fun (E) -> bool()</v>
 
227
        <v>Set1 = Set2 = set()</v>
 
228
      </type>
 
229
      <desc>
 
230
        <p>Filter elements in <c>Set1</c> with boolean function
 
231
          <c>Fun</c>.</p>
 
232
      </desc>
 
233
    </func>
 
234
  </funcs>
 
235
 
 
236
  <section>
 
237
    <title>See Also</title>
 
238
    <p><seealso marker="ordsets">ordsets(3)</seealso>,
 
239
      <seealso marker="gb_sets">gb_sets(3)</seealso></p>
 
240
  </section>
 
241
</erlref>
 
242