ordsets(3)

MODULE
ordsets - Functions for Manipulating Sets as Ordered Lists

DESCRIPTION

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.

EXPORTS

new_set() -> OrdSet

    Types
        OrdSet = ordset()

    Returns a new empty ordered set.

is_set(OrdSet) -> bool()

    Types
        OrdSet = term()

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

set_to_list(OrdSet) -> List

    Types
        OrdSet = ordset()
        List = [term()]

    Returns the elements of OrdSet as a list.

list_to_set(List) -> OrdSet

    Types
        List = [term()]
        OrdSet = ordset()

    Returns an ordered set of the elements in List.

is_element(Element, OrdSet) -> bool()

    Types
        Element = term()
        OrdSet = ordset()

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

add_element(Element, OrdSet1) -> OrdSet2

    Types
        Element = term()
        OrdSet1 = OrdSet2 = Ordset()

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

del_element(Element, OrdSet1) -> OrdSet2

    Types
        Element = term()
        OrdSet1 = OrdSet2 = ordset()

    Returns OrdSet1, but with Element removed.

union(OrdSet1, OrdSet2) -> OrdSet3

    Types
        OrdSet1 = OrdSet2 = OrdSet3 = ordset()

    Returns the merged (union) set of OrdSet1 and OrdSet2.

union(OrdSetList) -> OrdSet

    Types
        OrdSetList = [ordset()]
        OrdSet = ordset()

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

intersection(OrdSet1, OrdSet2) -> OrdSet3

    Types
        OrdSet1 = OrdSet2 = OrdSet3 = ordset()

    Returns the intersection of OrdSet1 and OrdSet2.

intersection(OrdSetList) -> OrdSet

    Types
        OrdSetList = [ordset()]
        OrdSet = ordset()

    Returns the intersection of the list of sets.

subtract(OrdSet1, OrdSet2) -> OrdSet3

    Types
        OrdSet1 = OrdSet2 = OrdSet3 = ordset()

    Returns only the elements of OrdSet1 which are not also elements of OrdSet2.

subset(OrdSet1, OrdSet2) -> bool()

    Types
        OrdSet1 = OrdSet2 = ordset()

    Returns true when every element of OrdSet1 is also a member of OrdSet2, otherwise false.

AUTHOR
Robert Virding - rv@erix.ericsson.se