Provided by: erlang-manpages_22.0.7+dfsg-1build1_all

**NAME**

ordsets - Functions for manipulating sets as ordered lists.

**DESCRIPTION**

Sets are collections of elements with no duplicate elements. Anordsetis 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. Elements are ordered according to theErlangtermorder. This module provides the same interface as thesets(3erl)module but with a defined representation. One difference is that whilesetsconsiders 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 (==).

**DATA** **TYPES**

ordset(T)= [T] As returned bynew/0.

**EXPORTS**

add_element(Element,Ordset1)->Ordset2Types: Element = E Ordset1 =ordset(T) Ordset2 =ordset(T | E) Returns a new ordered set formed fromOrdset1withElementinserted.del_element(Element,Ordset1)->Ordset2Types: Element = term() Ordset1 = Ordset2 =ordset(T) ReturnsOrdset1, but withElementremoved.filter(Pred,Ordset1)->Ordset2Types: Pred = fun((Element :: T) -> boolean()) Ordset1 = Ordset2 =ordset(T) Filters elements inOrdset1with boolean functionPred.fold(Function,Acc0,Ordset)->Acc1Types: Function = fun((Element :: T, AccIn :: term()) -> AccOut :: term()) Ordset =ordset(T) Acc0 = Acc1 = term() FoldsFunctionover every element inOrdsetand returns the final value of the accumulator.from_list(List)->OrdsetTypes: List = [T] Ordset =ordset(T) Returns an ordered set of the elements inList.intersection(OrdsetList)->OrdsetTypes: OrdsetList = [ordset(term()), ...] Ordset =ordset(term()) Returns the intersection of the non-empty list of sets.intersection(Ordset1,Ordset2)->Ordset3Types: Ordset1 = Ordset2 = Ordset3 =ordset(term()) Returns the intersection ofOrdset1andOrdset2.is_disjoint(Ordset1,Ordset2)->boolean()Types: Ordset1 = Ordset2 =ordset(term()) ReturnstrueifOrdset1andOrdset2are disjoint (have no elements in common), otherwisefalse.is_element(Element,Ordset)->boolean()Types: Element = term() Ordset =ordset(term()) ReturnstrueifElementis an element ofOrdset, otherwisefalse.is_empty(Ordset)->boolean()Types: Ordset =ordset(term()) ReturnstrueifOrdsetis an empty set, otherwisefalse.is_set(Ordset)->boolean()Types: Ordset = term() ReturnstrueifOrdsetis an ordered set of elements, otherwisefalse.is_subset(Ordset1,Ordset2)->boolean()Types: Ordset1 = Ordset2 =ordset(term()) Returnstruewhen every element ofOrdset1is also a member ofOrdset2, otherwisefalse.new()->[]Returns a new empty ordered set.size(Ordset)->integer()>=0Types: Ordset =ordset(term()) Returns the number of elements inOrdset.subtract(Ordset1,Ordset2)->Ordset3Types: Ordset1 = Ordset2 = Ordset3 =ordset(term()) Returns only the elements ofOrdset1that are not also elements ofOrdset2.to_list(Ordset)->ListTypes: Ordset =ordset(T) List = [T] Returns the elements ofOrdsetas a list.union(OrdsetList)->OrdsetTypes: OrdsetList = [ordset(T)] Ordset =ordset(T) Returns the merged (union) set of the list of sets.union(Ordset1,Ordset2)->Ordset3Types: Ordset1 =ordset(T1) Ordset2 =ordset(T2) Ordset3 =ordset(T1 | T2) Returns the merged (union) set ofOrdset1andOrdset2.

**SEE** **ALSO**

gb_sets(3erl),sets(3erl)