19962013 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. ordsets Robert Virding Bjarne Dacker 1 Bjarne Däcker 99-07-27 A ordsets.sgml
ordsets Functions for Manipulating Sets as Ordered Lists

Sets are collections of elements with no duplicate elements. An ordset is a representation of a set, where an ordered list is used to store the elements of the set. An ordered list is more efficient than an unordered list.

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

As returned by new/0.

Return an empty set

Returns a new empty ordered set.

Test for an Ordset

Returns true if Ordset is an ordered set of elements, otherwise false.

Return the number of elements in a set

Returns the number of elements in Ordset.

Convert an Ordsetinto a list

Returns the elements of Ordset as a list.

Convert a list into an Ordset

Returns an ordered set of the elements in List.

Test for membership of an Ordset

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

Add an element to an Ordset

Returns a new ordered set formed from Ordset1 with Element inserted.

Remove an element from an Ordset

Returns Ordset1, but with Element removed.

Return the union of two Ordsets

Returns the merged (union) set of Ordset1 and Ordset2.

Return the union of a list of Ordsets

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

Return the intersection of two Ordsets

Returns the intersection of Ordset1 and Ordset2.

Return the intersection of a list of Ordsets

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

Check whether two Ordsets are disjoint

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

Return the difference of two Ordsets

Returns only the elements of Ordset1 which are not also elements of Ordset2.

Test for subset

Returns true when every element of Ordset1 is also a member of Ordset2, otherwise false.

Fold over set elements

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

Filter set elements

Filter elements in Ordset1 with boolean function Pred.

See Also

gb_sets(3), sets(3)