generic

    type Item is private;
    with function "<" (Left : in Item; Right : in Item) return Boolean;
    with function Is_Equal (Left : in Item; Right : in Item) return Boolean;

package Halstead_List is

    --================================================================
    -- This package contains a generic list containing items and    ==
    -- their frequencies (number of times the same item is put      ==
    -- into the list using Put. After instantiating this package    ==
    -- and declaring an object of type List, we must Create the     ==
    -- object first before any other operations are performed.      ==
    -- Otherwise, the correctness of the following operations are   ==
    -- not guaranteed.                                              ==
    --================================================================

    type List is private;

    procedure Create (Empty_List : in out List);
    -- Create an empty list. MUST be used before any other
    -- operations below is used.

    procedure Put (This_Item : in Item; Into : in out List);
    -- Put an item into a list. If the given item is a new item,
    -- it will be put into the list. If the given item already
    -- exists, the frequency of the item will be incremented by
    -- one. Items will be stored in ASCENDING order.

    function Length_Of (This_List : in List) return Natural;
    -- Return the number of items in the list. ZERO will be
    -- returned if the given list is EMPTY.

    function Frequency_Of
                (This_Item : in Item; In_This : in List) return Natural;
    -- returns frequency of an item in a given list. If the item
    -- does not exist, ZERO is returned.

    generic
        with procedure Process (This_Item : in Item;
                                Frequency_Of_Item : in Natural);
    procedure Iterate (Across_The_List : in List);
    -- Iterate allows a user to visit every item in the list without
    -- changing the state of the list.

private

    type Node;
    --
    -- incomplete definition
    --
    type List is access Node;

end Halstead_List;