ASSetStructure.mesa
Last Edited by: November 19, 1987 8:37:46 am PST
Constructor: make a Structure whose underlying set is a given argument Set (i.e. an element of a Power Set Structure).
DIRECTORY
Rope,
IO,
AlgebraClasses;
ASSetStructure: CEDAR DEFINITIONS
~ BEGIN OPEN Rope, AC: AlgebraClasses;
Element Representation
SetStructureElement: TYPE = AC.Object;
Elements of a SetStructure are represented as elements of the universe of the PowerSet Structure to which the argument Set belongs (i.e. they have the same rep as the elements of the argument Set), except that their class fields are reset to point to the SetStructure. Thus they are just like elements of the argument Set, except that there is a level of "indirection" in their class fields, e.g. to operate on them, you have to follow their class pointer to the SetStructure, then get the elementUniverse of that SetStructure.
Structure Instance Data
SetStructureData: TYPE = REF SetStructureDataRec;
SetStructureDataRec:
TYPE =
RECORD [
definingSet: AC.Object, -- the elements of the Structure are the elements of definingSet
elementUniverse: AC.Object -- the universe of the PowerSetStructure to which definingSet belongs
];
Structure Constructor
MakeSetStructure: AC.StructureFromSetConstructor;
Structure Operations
ShortPrintName:
AC.ToRopeOp;
IsSetStructure:
AC.UnaryPredicate;
DefiningSet:
AC.UnaryOp;
selector: definingSet of a Set Structure
ElementUniverse:
AC.UnaryOp;
selector: elementUniverse of a Set Structure
StructureData:
AC.UnaryToListOp;
selector: returns LIST[definingSet, elementUniverse] of a Set Structure
Element Conversion and IO
CanRecast:
AC.BinaryPredicate;
LegalFirstChar:
AC.LegalFirstCharOp;
UnderlyingSetUniverseEltFromSSSElt:
AC.UnaryOp;
SSSEltFromUnderlyingSetUniverseElt:
AC.BinaryOp;
secondArg is a Single Set Structure, firstArg is an element of its underlyingSet represented as an element of the underlyingSet's universe. result is (a copy of) firstArg with its class reset to secondArg
IsVariable:
AC.UnaryPredicate;
check whether arg is a variable represented as an element of a SetStructure
VariableFromRope:
AC.FromRopeOp;
Get a variable from a rope, and recast it as an element of the SetStructure consisting of itself as the only element
END.