ClassDataRec: TYPE = RECORD [
Structure properties and operations
category: Category,
flavor: Rope.ROPE ← NIL,
Flavor identifies outermost constructor (if any) used to build objects of this structure. Is a rope to allow expansion without interface changes. Examples:
"Ints"
"BigRats"
"Points"
"Polynomials"
"Matrices"
"Quotients"
"Structures"
printName: PrintNameProc,
longNameGenerator: PrintNameProc,
shortPrintName: PrintNameProc, -- if none, should be set to printName
shortNameGenerator: PrintNameProc, -- if none, should be set to printName
code: Rope.ROPE, -- for quick checks of structure equality
structureEqual: StructureEqualityTest, -- should use codes
characteristic: StructureRankOp ← NIL, -- rings, fields, modules, vector spaces, algebras, divisionAlgebras only
dimension: StructureRankOp ← NIL,-- modules, vector spaces, algebras, divisionAlgebras only
reportOps: ReportOpsProc ← NIL,
Test whether a given item belongs to this structure (run-time typechecking): check equality of its structure's code with this structure's code.
isElementOf: ElementOfProc,
I/O and Conversion of Structure elements
legalFirstChar: LegalFirstCharOp,
read: ReadOp,
fromRope: FromRopeOp,
toRope: ToRopeOp,
write: WriteOp,
fromExpr: FromExprOp ← NIL,
toExpr: ToExprOp ← NIL,
toIndexRope: ToRopeOp, -- print short object key (for use in sequences of objects)
recast: UnaryImbedOp ← NIL, -- convert an element of a structure that conforms to this one (should be a noop on elements of this structure). Should use fastest available determination of structure, e.g. hashCode or shortPrintName.
Addition (lattices, rings, fields, vectorSpaces, algebras, divisionAlgebras only)
add: BinaryOp ← NIL,
negate: UnaryOp ← NIL,
subtract: BinaryOp ← NIL,
zero: NullaryOp ← NIL,
Multiplication (lattices, groups, rings, fields, algebras, divisionAlgebras only)
multiply: BinaryOp ← NIL, -- assumed associative; commutative or noncommutative ok
commutative: BOOL ← TRUE,
invert: UnaryOp ← NIL,
divide: BinaryOp ← NIL, -- (lattices only) set difference operation goes here if appropriate
one: NullaryOp,
Equality testing
equal: EqualityOp ← NIL, -- need not be present in sets and lattices
Module ops
rightModule: BOOL ← FALSE, -- modules are left modules by default
Scalar multiplication (modules, vectorSpaces, algebras, divisionAlgebras only)
scalarMultiply: BinaryOp ← NIL, -- unless rightModule, this is left multiplication, i.e. scalar * vector. The underlying field of a vector space may be commutative or noncommutative.
Lattice ops
booleanAlgebra: BOOL ← FALSE,
complement: UnaryOp ← NIL,
Ordered structure ops (rings, fields, modules, vectorSpaces, algebras, divisionAlgebras only)
ordered: BOOL ← FALSE,
sign: CompareToZeroOp ← NIL,
abs: UnaryOp ← NIL,
compare: BinaryCompareOp ← NIL,
Common varieties of rings (and algebras) and their ops
integralDomain: BOOL ← FALSE,
gcdDomain: BOOL ← FALSE,
gcd: BinaryOp ← NIL, -- gcdDomains only
euclideanDomain: BOOL ← FALSE,
remainder: BinaryOp ← NIL, -- euclideanDomains only
degree: ElementRankOp ← NIL, -- euclideanDomains only
Common varieties of fields (and divisionAlgebras) and their ops
completeField: BOOL ← FALSE,
realField: BOOL ← FALSE,
realClosedField: BOOL ← FALSE,
algebraicallyClosedField: BOOL ← FALSE,
propList: Atom.PropList ← NIL
];