20002013 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. sets Robert Virding Bjarne Dacker 1 Bjarne Däcker 99-07-27 A sets.sgml
sets Functions for Set Manipulation

Sets are collections of elements with no duplicate elements. The representation of a set is not defined.

This module provides exactly the same interface as the module ordsets but with a defined representation. One difference is that while this module considers two elements as different if they do not match (=:=), ordsets considers two elements as different if and only if they do not compare equal (==).

set()

As returned by new/0.

Return an empty set

Returns a new empty set.

Test for an Set

Returns true if Set is a set of elements, otherwise false.

Return the number of elements in a set

Returns the number of elements in Set.

Convert an Setinto a list

Returns the elements of Set as a list.

Convert a list into an Set

Returns an set of the elements in List.

Test for membership of an Set

Returns true if Element is an element of Set, otherwise false.

Add an element to an Set

Returns a new set formed from Set1 with Element inserted.

Remove an element from an Set

Returns Set1, but with Element removed.

Return the union of two Sets

Returns the merged (union) set of Set1 and Set2.

Return the union of a list of Sets

Returns the merged (union) set of the list of sets.

Return the intersection of two Sets

Returns the intersection of Set1 and Set2.

Return the intersection of a list of Sets

Returns the intersection of the non-empty list of sets.

Check whether two Sets are disjoint

Returns true if Set1 and Set2 are disjoint (have no elements in common), and false otherwise.

Return the difference of two Sets

Returns only the elements of Set1 which are not also elements of Set2.

Test for subset

Returns true when every element of Set11 is also a member of Set2, otherwise false.

Fold over set elements

Fold Function over every element in Set returning the final value of the accumulator.

Filter set elements

Filter elements in Set1 with boolean function Pred.

See Also

ordsets(3), gb_sets(3)