Start Code
RealClass: AC.StructureClass ← NEW[AC.StructureClassRec ← [
category: field,
printName: ClassPrintName,
shortPrintName: ClassShortPrintName,
structureEqual: AC.defaultStructureEqualityTest,
characteristic: ClassCharacteristic,
isElementOf: AC.defaultElementOfProc,
legalFirstChar: ClassLegalFirstChar,
read: Read,
fromRope: FromRope,
toRope: ToRope,
write: Write,
toExpr: ClassToExpr,
add: Add,
negate: Negate,
subtract: Subtract,
zero: ClassZero,
multiply: Multiply,
commutative: TRUE,
invert: Invert,
divide: Divide,
one: ClassOne,
equal: Equal,
ordered: TRUE,
sign: Sign,
abs: Abs,
compare: Compare,
completeField: TRUE,
realField: TRUE,
realClosedField: TRUE,
algebraicallyClosedField: FALSE,
propList: NIL
] ];
Reals: PUBLIC AC.Structure ← NEW[AC.StructureRec ← [
class: RealClass,
instanceData: NIL
] ];
RealClass: Object ← AC.MakeClass["RealClass", NIL, NIL];
Reals: PUBLIC Object ← AC.MakeStructure["Reals", RealClass, NIL];
RealOne: Real ← FromREAL[1.0]; -- do after Reals set
RealZero: Real ← FromREAL[0.0];
categoryMethod: Method ← AC.MakeMethod[Value, FALSE, NEW[AC.Category ← field], NIL, "category"];
groundStructureMethod: Method ← AC.MakeMethod[Value, FALSE, NIL, NIL, "groundStructure"];
shortPrintNameMethod: Method ← AC.MakeMethod[ToRopeOp, FALSE, NEW[AC.ToRopeOp ← ShortPrintName], NIL, "shortPrintName"];
recastMethod: Method ← AC.MakeMethod[BinaryOp, TRUE, NEW[AC.BinaryOp ← Recast], NIL, "recast"];
canRecastMethod: Method ← AC.MakeMethod[BinaryPredicate, TRUE, NEW[AC.BinaryPredicate ← CanRecast], NIL, "canRecast"];
legalFirstCharMethod: Method ← AC.MakeMethod[LegalFirstCharOp, FALSE, NEW[AC.LegalFirstCharOp ← LegalFirstChar], NIL, "legalFirstChar"];
readMethod: Method ← AC.MakeMethod[ReadOp, FALSE, NEW[AC.ReadOp ← Read], NIL, "read"];
fromRopeMethod: Method ← AC.MakeMethod[FromRopeOp, TRUE, NEW[AC.FromRopeOp ← FromRope], NIL, "fromRope"];
toRopeMethod: Method ← AC.MakeMethod[ToRopeOp, FALSE, NEW[AC.ToRopeOp ← ToRope], NIL, "toRope"];
toExprMethod: Method ← AC.MakeMethod[ToExprOp, FALSE, NEW[AC.ToExprOp ← ToExpr], NEW[AC.UnaryToListOp ← RealsDesired], "toExpr"];
realMethod: Method ← AC.MakeMethod[FromRopeOp, FALSE, NEW[AC.FromRopeOp ← FromRope], NIL, "real"];
parenMethod: Method ← AC.MakeMethod[UnaryOp, FALSE, NEW[AC.UnaryOp ← AC.Copy], NIL, "paren"];
zeroMethod: Method ← AC.MakeMethod[NullaryOp, FALSE, NEW[AC.NullaryOp ← Zero], NIL, "zero"];
oneMethod: Method ← AC.MakeMethod[NullaryOp, FALSE, NEW[AC.NullaryOp ← One], NIL, "one"];
sumMethod: Method ← AC.MakeMethod[BinaryOp, TRUE, NEW[AC.BinaryOp ← Add], NEW[AC.UnaryToListOp ← RealsDesired], "sum"];
negationMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← Negate], NEW[AC.UnaryToListOp ← RealsDesired], "negation"];
differenceMethod: Method ← AC.MakeMethod[BinaryOp, TRUE, NEW[AC.BinaryOp ← Subtract], NEW[AC.UnaryToListOp ← RealsDesired], "difference"];
productMethod: Method ← AC.MakeMethod[BinaryOp, TRUE, NEW[AC.BinaryOp ← Multiply], NEW[AC.UnaryToListOp ← RealsDesired], "product"];
commutativeMethod: Method ← AC.MakeMethod[Value, FALSE, NIL, NIL, "commutative"];
powerMethod: Method ← AC.MakeMethod[BinaryOp, TRUE, NEW[AC.BinaryOp ← Power], NEW[AC.UnaryToListOp ← ObjectAndIntDesired], "power"];
invertMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← Invert], NEW[AC.UnaryToListOp ← RealsDesired], "invert"];
fractionMethod: Method ← AC.MakeMethod[BinaryOp, TRUE, NEW[AC.BinaryOp ← Divide], NEW[AC.UnaryToListOp ← RealsDesired], "fraction"];
expMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← Exp], NEW[AC.UnaryToListOp ← RealsDesired], "exp"];
lnMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← Ln], NEW[AC.UnaryToListOp ← RealsDesired], "ln"];
sqRtMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← SqRt], NEW[AC.UnaryToListOp ← RealsDesired], "sqRt"];
sinMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← Sin], NEW[AC.UnaryToListOp ← RealsDesired], "sin"];
cosMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← Cos], NEW[AC.UnaryToListOp ← RealsDesired], "cos"];
tanMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← Tan], NEW[AC.UnaryToListOp ← RealsDesired], "tan"];
equalMethod: Method ← AC.MakeMethod[BinaryPredicate, TRUE, NEW[AC.BinaryPredicate ← Equal], NEW[AC.UnaryToListOp ← RealsDesired], "equals"];
orderedMethod: Method ← AC.MakeMethod[Value, FALSE, NIL, NIL, "ordered"];
signMethod: Method ← AC.MakeMethod[CompareToZeroOp, TRUE, NEW[AC.CompareToZeroOp ← Sign], NEW[AC.UnaryToListOp ← RealsDesired], "sign"];
absMethod: Method ← AC.MakeMethod[UnaryOp, TRUE, NEW[AC.UnaryOp ← Abs], NEW[AC.UnaryToListOp ← RealsDesired], "abs"];
compareMethod: Method ← AC.MakeMethod[BinaryCompareOp, TRUE, NEW[AC.BinaryCompareOp ← Compare], NEW[AC.UnaryToListOp ← RealsDesired], "compare"];
AC.AddMethodToClass[$category, categoryMethod, RealClass];
AC.AddMethodToClass[$groundStructure, categoryMethod, RealClass];
AC.AddMethodToClass[$shortPrintName, shortPrintNameMethod, RealClass];
AC.AddMethodToClass[$recast, recastMethod, RealClass];
AC.AddMethodToClass[$canRecast, canRecastMethod, RealClass];
AC.AddMethodToClass[$legalFirstChar, legalFirstCharMethod, RealClass];
AC.AddMethodToClass[$read, readMethod, RealClass];
AC.AddMethodToClass[$fromRope, fromRopeMethod, RealClass];
AC.AddMethodToClass[$toRope, toRopeMethod, RealClass];
AC.AddMethodToClass[$toExpr, toExprMethod, RealClass];
AC.AddMethodToClass[$real, realMethod, RealClass];
AC.AddMethodToClass[$zero, zeroMethod, RealClass];
AC.AddMethodToClass[$one, oneMethod, RealClass];
AC.AddMethodToClass[$paren, parenMethod, RealClass];
AC.AddMethodToClass[$sum, sumMethod, RealClass];
AC.AddMethodToClass[$negation, negationMethod, RealClass];
AC.AddMethodToClass[$difference, differenceMethod, RealClass];
AC.AddMethodToClass[$product, productMethod, RealClass];
AC.AddMethodToClass[$invert, invertMethod, RealClass];
AC.AddMethodToClass[$pow, powerMethod, RealClass];
AC.AddMethodToClass[$commutative, commutativeMethod, RealClass];
AC.AddMethodToClass[$fraction, fractionMethod, RealClass];
AC.AddMethodToClass[$exp, expMethod, RealClass];
AC.AddMethodToClass[$ln, lnMethod, RealClass];
AC.AddMethodToClass[$radical, sqRtMethod, RealClass];
AC.AddMethodToClass[$sin, sinMethod, RealClass];
AC.AddMethodToClass[$cos, cosMethod, RealClass];
AC.AddMethodToClass[$tan, tanMethod, RealClass];
AC.AddMethodToClass[$eqFormula, equalMethod, RealClass];
AC.AddMethodToClass[$ordered, orderedMethod, RealClass];
AC.AddMethodToClass[$sign, signMethod, RealClass];
AC.AddMethodToClass[$abs, absMethod, RealClass];
AC.AddMethodToClass[$compare, compareMethod, RealClass];
AC.InstallStructure[Reals];
AC.SetSuperClass[BigRats.BigRats, Reals];