-- Last changed by: 26-Jun-81 18:28:36
-- Cedar version:18-Jun-81 14:24:37
-- Ordered pairs; building and searching
-- Nearly the same as RelationDefs, written by Rick Tiberi

PairList: DEFINITIONS =
BEGIN
RelationHead: TYPE = RECORD[first, last: REF Pair];
Relation: TYPE = REF RelationHead;
Pair: TYPE = RECORD[link: REF Pair, left, right: REF ANY ← NIL];
NotFound: SIGNAL;
EqualProc: TYPE = PROC[left,right: REF ANY] RETURNS[return: BOOLEAN];

CreateRelation: PROCEDURE RETURNS [Relation];
AddPair: PROCEDURE [relation: Relation, left, right: REF ANY ← NIL];
Left: PROCEDURE[relation: Relation, equals: EqualProc, right: REF ANY ← NIL]
	RETURNS [REF ANY ← NIL];
Right: PROCEDURE[relation: Relation, equals: EqualProc, left: REF ANY ← NIL]
	RETURNS [REF ANY ← NIL];
ForAllPairs: PROCEDURE[relation: Relation,
	do: PROCEDURE[leftPart, rightPart: REF ANY ← NIL]];
DestroyRelation: PROCEDURE[relation: Relation];
END.