GENERIC INTERFACE List(Elem);Where "Elem.T" is not an open array type and "Elem" contains
| CONST Brand ="Brand" must be a text constant. It will be used to construct a brand for any generic types instantiated with the "List" interface. For a non-generic interface, we recommend choosing the name of the interface.; | PROCEDURE Equal(k1, k2: Elem.T): BOOLEAN;
"Equal" may be declared with a parameter mode of either "VALUE" or "READONLY", but not "VAR".
A "List.T" represents a linked list of items of type "Elem.T".
None of the operations of this interface modify the "head" field of an existing list element. Operations that may modify the "tail" field of existing list elements are called destructive . By convention, their names end in "D".
GENERIC INTERFACE ListSort(Elem, ElemList);Where "Elem.T" is not an open array type, "ElemList" equals "List(Elem)", and "Elem" contains
| CONST Brand ="Brand" must be a text constant. It will be used to construct a brand for any generic types instantiated with the "ListSort" interface. For a non-generic interface, we recommend choosing the name of the interface.; | PROCEDURE Compare(e1, e2: Elem.T): [-1..1];
"Compare" must be a total order. It may be declared with any parameter mode, but must have no visible side-effects.
The implementation is time- and cons-efficient but not guaranteed to be stable. "Sort" copies the cells; "SortD" modifies the "tail" fields of the existing cells.