<> <> <> <> <> DIRECTORY MathExpr, MathRules, MathDB, MathTypes, MathBox, Imager, Rope, Vector, MathConstructors; MathExprClassesList: CEDAR PROGRAM IMPORTS MathBox, MathRules, MathExpr, MathDB, MathConstructors ~ BEGIN <> EXPR: TYPE ~ MathExpr.EXPR; BOX: TYPE ~ MathBox.BOX; ROPE: TYPE ~ Rope.ROPE; VEC: TYPE ~ Vector.VEC; CompoundBoxProc: TYPE ~ MathRules.CompoundBoxProc; CompositionProc: TYPE ~ MathRules.CompositionProc; Alignment2D: TYPE ~ MathRules.Alignment2D; Offset: TYPE ~ MathRules.Offset; Size: TYPE ~ MathRules.Size; Argument: TYPE ~ MathExpr.Argument; Symbol: TYPE ~ MathExpr.Symbol; CompoundClass: TYPE ~ MathExpr.CompoundClass; FormatClass: TYPE ~ MathTypes.FormatClass; Style: TYPE ~ MathTypes.Style; <> MakeArgument: PROC[name: ATOM, aliases: LIST OF ATOM, size: Size] RETURNS[Argument] ~ MathExpr.MakeArgument; MakeSymbol: PROC[name: ATOM, aliases: LIST OF ATOM, size: Size, value: EXPR] RETURNS[Symbol] ~ MathExpr.MakeSymbol; MakeCompoundClass: PROC[name: ATOM, formatClass: FormatClass, description: ROPE, args: LIST OF Argument, syms: LIST OF Symbol, boxRule: CompoundBoxProc, compBox: CompositionProc, cvtAS, cvtReduce, cvtSMP, cvtOther: ROPE _ NIL] RETURNS[CompoundClass] ~ MathExpr.MakeCompoundClass; <> smallGap: REAL = 0.05; medGap: REAL = 0.10; bigGap: REAL = 0.25; <> FixedSizeBoxRule: CompoundBoxProc ~ { <> RETURN[boxes]; }; ParenBoxRule: CompoundBoxProc ~ { <> <<>> leftParenBox: BOX _ MathBox.GetBox[$leftParen, boxes]; rightParenBox: BOX _ MathBox.GetBox[$rightParen, boxes]; aBox: BOX _ MathBox.GetBox[$a, boxes]; <> scaleFactor: REAL _ MAX[0.25, 1.1 * aBox.Height[] / leftParenBox.Height[]]; leftParenBox _ MathBox.Scale[leftParenBox, [scaleFactor, scaleFactor]]; rightParenBox _ MathBox.Scale[rightParenBox, [scaleFactor, scaleFactor]]; RETURN[LIST[aBox, leftParenBox, rightParenBox]]; }; CurlyBoxRule: CompoundBoxProc ~ { <> <<>> leftCurlyBox: BOX _ MathBox.GetBox[$leftCurly, boxes]; rightCurlyBox: BOX _ MathBox.GetBox[$rightCurly, boxes]; aBox: BOX _ MathBox.GetBox[$a, boxes]; <> scaleFactor: REAL _ MAX[0.25, 1.1 * aBox.Height[] / leftCurlyBox.Height[]]; leftCurlyBox _ MathBox.Scale[leftCurlyBox, [scaleFactor, scaleFactor]]; rightCurlyBox _ MathBox.Scale[rightCurlyBox, [scaleFactor, scaleFactor]]; RETURN[LIST[aBox, leftCurlyBox, rightCurlyBox]]; }; SquareBoxRule: CompoundBoxProc ~ { <> <<>> leftSquareBox: BOX _ MathBox.GetBox[$leftSquare, boxes]; rightSquareBox: BOX _ MathBox.GetBox[$rightSquare, boxes]; aBox: BOX _ MathBox.GetBox[$a, boxes]; <> scaleFactor: REAL _ MAX[0.25, 1.1 * aBox.Height[] / leftSquareBox.Height[]]; leftSquareBox _ MathBox.Scale[leftSquareBox, [scaleFactor, scaleFactor]]; rightSquareBox _ MathBox.Scale[rightSquareBox, [scaleFactor, scaleFactor]]; RETURN[LIST[aBox, leftSquareBox, rightSquareBox]]; }; <> <> <<>> <> <> <> <<>> <> <> <> <> <<>> <> <<};>> <<>> minParenSize: REAL = 0.5; parensToArgs: REAL = 1.2; -- scale factor UnaryFunctionBoxRule: CompoundBoxProc ~ { <> <> fBox: BOX _ MathBox.GetBox[$f, boxes]; funSpaceBox: BOX _ MathBox.GetBox[$funSpace, boxes]; lParenBox: BOX _ MathBox.GetBox[$leftParen, boxes]; arg1Box: BOX _ MathBox.GetBox[$arg1, boxes]; rParenBox: BOX _ MathBox.GetBox[$rightParen, boxes]; <> scaleFactor: REAL _ MAX[minParenSize, parensToArgs * arg1Box.Height[] / lParenBox.Height[]]; lParenBox _ MathBox.Scale[lParenBox, [scaleFactor, scaleFactor]]; rParenBox _ MathBox.Scale[rParenBox, [scaleFactor, scaleFactor]]; <<>> RETURN[LIST[fBox, funSpaceBox, lParenBox, arg1Box, rParenBox] ]; }; BinaryFunctionBoxRule: CompoundBoxProc ~ { <> <> fBox: BOX _ MathBox.GetBox[$f, boxes]; funSpaceBox: BOX _ MathBox.GetBox[$funSpace, boxes]; lParenBox: BOX _ MathBox.GetBox[$leftParen, boxes]; arg1Box: BOX _ MathBox.GetBox[$arg1, boxes]; comma12Box: BOX _ MathBox.GetBox[$comma12, boxes]; arg12SpaceBox: BOX _ MathBox.GetBox[$arg12Space, boxes]; arg2Box: BOX _ MathBox.GetBox[$arg2, boxes]; rParenBox: BOX _ MathBox.GetBox[$rightParen, boxes]; <> scaleFactor: REAL _ MAX[ minParenSize, parensToArgs * MAX[arg1Box.Height[], arg2Box.Height[] ] / lParenBox.Height[] ]; lParenBox _ MathBox.Scale[lParenBox, [scaleFactor, scaleFactor]]; comma12Box _ MathBox.Scale[comma12Box, [scaleFactor, scaleFactor]]; rParenBox _ MathBox.Scale[rParenBox, [scaleFactor, scaleFactor]]; <<>> RETURN[LIST[fBox, funSpaceBox, lParenBox, arg1Box, comma12Box, arg12SpaceBox, arg2Box, rParenBox] ]; }; TernaryFunctionBoxRule: CompoundBoxProc ~ { <> <> fBox: BOX _ MathBox.GetBox[$f, boxes]; funSpaceBox: BOX _ MathBox.GetBox[$funSpace, boxes]; lParenBox: BOX _ MathBox.GetBox[$leftParen, boxes]; arg1Box: BOX _ MathBox.GetBox[$arg1, boxes]; comma12Box: BOX _ MathBox.GetBox[$comma12, boxes]; arg12SpaceBox: BOX _ MathBox.GetBox[$arg12Space, boxes]; arg2Box: BOX _ MathBox.GetBox[$arg2, boxes]; comma23Box: BOX _ MathBox.GetBox[$comma23, boxes]; arg23SpaceBox: BOX _ MathBox.GetBox[$arg23Space, boxes]; arg3Box: BOX _ MathBox.GetBox[$arg3, boxes]; rParenBox: BOX _ MathBox.GetBox[$rightParen, boxes]; <> scaleFactor: REAL _ MAX[ minParenSize, parensToArgs * MAX[arg1Box.Height[], arg2Box.Height[], arg3Box.Height[] ] / lParenBox.Height[] ]; lParenBox _ MathBox.Scale[lParenBox, [scaleFactor, scaleFactor]]; comma12Box _ MathBox.Scale[comma12Box, [scaleFactor, scaleFactor]]; comma23Box _ MathBox.Scale[comma23Box, [scaleFactor, scaleFactor]]; rParenBox _ MathBox.Scale[rParenBox, [scaleFactor, scaleFactor]]; <<>> RETURN[LIST[fBox, funSpaceBox, lParenBox, arg1Box, comma12Box, arg12SpaceBox, arg2Box, comma23Box, arg23SpaceBox, arg3Box, rParenBox] ]; }; QuaternaryFunctionBoxRule: CompoundBoxProc ~ { <> <> fBox: BOX _ MathBox.GetBox[$f, boxes]; funSpaceBox: BOX _ MathBox.GetBox[$funSpace, boxes]; lParenBox: BOX _ MathBox.GetBox[$leftParen, boxes]; arg1Box: BOX _ MathBox.GetBox[$arg1, boxes]; comma12Box: BOX _ MathBox.GetBox[$comma12, boxes]; arg12SpaceBox: BOX _ MathBox.GetBox[$arg12Space, boxes]; arg2Box: BOX _ MathBox.GetBox[$arg2, boxes]; comma23Box: BOX _ MathBox.GetBox[$comma23, boxes]; arg23SpaceBox: BOX _ MathBox.GetBox[$arg23Space, boxes]; arg3Box: BOX _ MathBox.GetBox[$arg3, boxes]; comma34Box: BOX _ MathBox.GetBox[$comma34, boxes]; arg34SpaceBox: BOX _ MathBox.GetBox[$arg34Space, boxes]; arg4Box: BOX _ MathBox.GetBox[$arg4, boxes]; rParenBox: BOX _ MathBox.GetBox[$rightParen, boxes]; <> scaleFactor: REAL _ MAX[ minParenSize, parensToArgs * MAX[arg1Box.Height[], arg2Box.Height[], arg3Box.Height[], arg4Box.Height[] ] / lParenBox.Height[] ]; lParenBox _ MathBox.Scale[lParenBox, [scaleFactor, scaleFactor]]; comma12Box _ MathBox.Scale[comma12Box, [scaleFactor, scaleFactor]]; comma23Box _ MathBox.Scale[comma23Box, [scaleFactor, scaleFactor]]; comma34Box _ MathBox.Scale[comma34Box, [scaleFactor, scaleFactor]]; rParenBox _ MathBox.Scale[rParenBox, [scaleFactor, scaleFactor]]; <<>> RETURN[LIST[fBox, funSpaceBox, lParenBox, arg1Box, comma12Box, arg12SpaceBox, arg2Box, comma23Box, arg23SpaceBox, arg3Box, comma34Box, arg34SpaceBox, arg4Box, rParenBox] ]; }; <> ListCompRule: CompositionProc ~ { <> tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$car, [$comma, [right], [left]], [$comma, [origin], [origin]]], [$space, [$comma, [left], [right]], [$comma, [origin], [origin]]], [$cdr, [$space, [left], [right]], [$comma, [origin], [origin]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$car, [origin]], [$comma, [origin]]]; RETURN[tempBox, tempBoxes]; }; NullaryFunctionCompRule: CompositionProc ~ { <> tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$leftParen, [$rightParen, [right], [left]], [$rightParen, [center], [center]]], [$funSpace, [$leftParen, [right], [left]], [$leftParen, [origin], [origin]]], [$f, [$funSpace, [right], [left]], [$leftParen, [origin], [origin]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$f, [origin]], [$f, [origin]]]; RETURN[tempBox, tempBoxes]; }; UnaryFunctionCompRule: CompositionProc ~ { <> tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$leftParen, [$arg1, [right], [left]], [$arg1, [center], [center]]], [$rightParen, [$arg1, [left], [right]], [$leftParen, [center], [center]]], [$funSpace, [$leftParen, [right], [left]], [$arg1, [origin], [origin]]], [$f, [$funSpace, [right], [left]], [$arg1, [origin], [origin]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$f, [origin]], [$f, [origin]]]; RETURN[tempBox, tempBoxes]; }; BinaryFunctionCompRule: CompositionProc ~ { tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$leftParen, [$arg1, [right], [left]], [$arg1, [center], [center]]], [$comma12, [$arg1, [left], [right]], [$arg1, [origin], [origin]]], [$arg12Space, [$comma12, [left], [right]], [$comma12, [origin], [origin]]], [$arg2, [$arg12Space, [left], [right]], [$arg12Space, [origin], [origin]]], [$rightParen, [$arg2, [left], [right]], [$leftParen, [center], [center]]], [$funSpace, [$leftParen, [right], [left]], [$arg1, [origin], [origin]]], [$f, [$funSpace, [right], [left]], [$arg1, [origin], [origin]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$f, [origin]], [$f, [origin]]]; RETURN[tempBox, tempBoxes]; }; TernaryFunctionCompRule: CompositionProc ~ { tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$leftParen, [$arg1, [right], [left]], [$arg1, [center], [center]]], [$comma12, [$arg1, [left], [right]], [$arg1, [origin], [origin]]], [$arg12Space, [$comma12, [left], [right]], [$comma12, [origin], [origin]]], [$arg2, [$arg12Space, [left], [right]], [$arg12Space, [origin], [origin]]], [$comma23, [$arg2, [left], [right]], [$arg2, [origin], [origin]]], [$arg23Space, [$comma23, [left], [right]], [$comma23, [origin], [origin]]], [$arg3, [$arg23Space, [left], [right]], [$arg23Space, [origin], [origin]]], [$rightParen, [$arg3, [left], [right]], [$leftParen, [center], [center]]], [$funSpace, [$leftParen, [right], [left]], [$arg1, [origin], [origin]]], [$f, [$funSpace, [right], [left]], [$arg1, [origin], [origin]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$f, [origin]], [$f, [origin]]]; RETURN[tempBox, tempBoxes]; }; QuaternaryFunctionCompRule: CompositionProc ~ { tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$leftParen, [$arg1, [right], [left]], [$arg1, [center], [center]]], [$comma12, [$arg1, [left], [right]], [$arg1, [origin], [origin]]], [$arg12Space, [$comma12, [left], [right]], [$comma12, [origin], [origin]]], [$arg2, [$arg12Space, [left], [right]], [$arg12Space, [origin], [origin]]], [$comma23, [$arg2, [left], [right]], [$arg2, [origin], [origin]]], [$arg23Space, [$comma23, [left], [right]], [$comma23, [origin], [origin]]], [$arg3, [$arg23Space, [left], [right]], [$arg23Space, [origin], [origin]]], [$comma34, [$arg3, [left], [right]], [$arg3, [origin], [origin]]], [$arg34Space, [$comma34, [left], [right]], [$comma34, [origin], [origin]]], [$arg4, [$arg34Space, [left], [right]], [$arg34Space, [origin], [origin]]], [$rightParen, [$arg4, [left], [right]], [$leftParen, [center], [center]]], [$funSpace, [$leftParen, [right], [left]], [$arg1, [origin], [origin]]], [$f, [$funSpace, [right], [left]], [$arg1, [origin], [origin]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$f, [origin]], [$f, [origin]]]; RETURN[tempBox, tempBoxes]; }; UnaryOpCompRule: CompositionProc ~ { <> tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$aliasSpace, [$aliasUnaryOp, [left], [right]], [$aliasUnaryOp, [origin], [origin]]], [$aliasA, [$aliasSpace, [left], [right]], [$aliasSpace, [origin], [origin]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$aliasUnaryOp, [origin]], [$aliasUnaryOp, [origin]]]; RETURN[tempBox, tempBoxes]; }; BinaryOpCompRule: CompositionProc ~ { <> << symbols $aliasLeftSpace & $aliasRightSpace.>> <<>> tempBox: BOX; tempBoxes: LIST OF BOX; leftVertOffsetA, leftVertOffsetOp, rightVertOffsetB, rightVertOffsetOp: Offset; alignments: LIST OF Alignment2D; <> SELECT MathBox.GetBox[$aliasA, boxes].FormatClass[] FROM over => { leftVertOffsetA _ [origin]; leftVertOffsetOp _ [center]; }; matrix => { leftVertOffsetA _ [center]; leftVertOffsetOp _ [center]; }; ENDCASE => { leftVertOffsetA _ [origin]; leftVertOffsetOp _ [origin]; }; SELECT MathBox.GetBox[$aliasB, boxes].FormatClass[] FROM over => { rightVertOffsetB _ [origin]; rightVertOffsetOp _ [center]; }; matrix => { rightVertOffsetB _ [center]; rightVertOffsetOp _ [center]; }; ENDCASE => { rightVertOffsetB _ [origin]; rightVertOffsetOp _ [origin]; }; alignments _ LIST[ [$aliasLeftSpace, [$aliasBinOp, [right], [left]], [$aliasBinOp, [origin], [origin]]], [$aliasA, [$aliasLeftSpace, [right], [left]], [$aliasBinOp, leftVertOffsetA, leftVertOffsetOp]], [$aliasRightSpace, [$aliasBinOp, [left], [right]], [$aliasBinOp, [origin], [origin]]], [$aliasB, [$aliasRightSpace, [left], [right]], [$aliasBinOp, rightVertOffsetB, rightVertOffsetOp]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$aliasA, [origin]], [$aliasBinOp, [origin]]]; RETURN[tempBox, tempBoxes]; }; RelationCompRule: CompositionProc ~ { <> << symbols $aliasLeftSpace & $aliasRightSpace.>> <<>> tempBox: BOX; tempBoxes: LIST OF BOX; leftVertOffsetLHS, leftVertOffsetRel, rightVertOffsetRHS, rightVertOffsetRel: Offset; alignments: LIST OF Alignment2D; <> SELECT MathBox.GetBox[$aliasLHS, boxes].FormatClass[] FROM over => { leftVertOffsetLHS _ [origin]; leftVertOffsetRel _ [center]; }; matrix => { leftVertOffsetLHS _ [center]; leftVertOffsetRel _ [center]; }; ENDCASE => { leftVertOffsetLHS _ [origin]; leftVertOffsetRel _ [origin]; }; SELECT MathBox.GetBox[$aliasRHS, boxes].FormatClass[] FROM over => { rightVertOffsetRHS _ [origin]; rightVertOffsetRel _ [center]; }; matrix => { rightVertOffsetRHS _ [center]; rightVertOffsetRel _ [center]; }; ENDCASE => { rightVertOffsetRHS _ [origin]; rightVertOffsetRel _ [origin]; }; alignments _ LIST[ [$aliasLeftSpace, [$aliasRelation, [right], [left]], [$aliasRelation, [origin], [origin]]], [$aliasLHS, [$aliasLeftSpace, [right], [left]], [$aliasRelation, leftVertOffsetLHS, leftVertOffsetRel]], [$aliasRightSpace, [$aliasRelation, [left], [right]], [$aliasRelation, [origin], [origin]]], [$aliasRHS, [$aliasRightSpace, [left], [right]], [$aliasRelation, rightVertOffsetRHS, rightVertOffsetRel]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$aliasLHS, [origin]], [$aliasRelation, [origin]]]; RETURN[tempBox, tempBoxes]; }; ParenCompRule: CompositionProc ~ { <> << $leftParen and $rightParen>> tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$leftParen, [$a, [right], [left]], [$a, [center], [center]]], [$rightParen, [$a, [left], [right]], [$a, [center], [center]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$leftParen, [origin]], [$self, [center, -0.25]]]; RETURN[tempBox, tempBoxes]; }; CurlyCompRule: CompositionProc ~ { <> << $leftCurly and $rightCurly>> tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$leftCurly, [$a, [right], [left]], [$a, [center], [center]]], [$rightCurly, [$a, [left], [right]], [$a, [center], [center]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$leftCurly, [origin]], [$self, [center, -0.25]]]; RETURN[tempBox, tempBoxes]; }; SquareCompRule: CompositionProc ~ { <> << $leftSquare and $rightSquare>> tempBox: BOX; tempBoxes: LIST OF BOX; alignments: LIST OF Alignment2D _ LIST[ [$leftSquare, [$a, [right], [left]], [$a, [center], [center]]], [$rightSquare, [$a, [left], [right]], [$a, [center], [center]]]]; [tempBox, tempBoxes] _ MathRules.Compose[boxes, alignments, [$leftSquare, [origin]], [$self, [center, -0.25]]]; RETURN[tempBox, tempBoxes]; }; <> MakeUnaryOpClass: PUBLIC PROC[class, op, arg: ATOM, operation: EXPR, description: ROPE, cvtAS, cvtReduce, cvtSMP, cvtOther: ROPE _ NIL] RETURNS[CompoundClass] ~ { <> << The alignment is "operation arg"; alignment is thru baselines. >> << Both op, arg are of fixed size "normal".>> <<>> argArg: Argument _ MakeArgument[arg, LIST[$aliasA, $aliasHot], normal]; spaceSym: Symbol _ MakeSymbol[$Space, LIST[$aliasSpace], normal, MathConstructors.MakeSpace[$medium]]; unaryOpSym: Symbol _ MakeSymbol[op, LIST[$aliasUnaryOp], normal, operation]; RETURN[MakeCompoundClass[class, unaryOp, description, LIST[argArg], LIST[unaryOpSym, spaceSym], FixedSizeBoxRule, UnaryOpCompRule, cvtAS]]; }; MakeRelationClass: PUBLIC PROC[class, rel, lhs, rhs: ATOM, relation: EXPR, description: ROPE, cvtAS, cvtReduce, cvtSMP, cvtOther: ROPE _ NIL] RETURNS[CompoundClass] ~ { <> << The alignment is "lhs relation rhs"; alignment is thru baselines. >> << All of lhs, rhs, rel are of fixed size "normal".>> lhsArg: Argument _ MakeArgument[lhs, LIST[$aliasLHS, $aliasHot], normal]; rhsArg: Argument _ MakeArgument[rhs, LIST[$aliasRHS], normal]; relSym: Symbol _ MakeSymbol[rel, LIST[$aliasRelation], normal, relation]; leftSpace: Symbol _ MakeSymbol[$leftSpace, LIST[$aliasLeftSpace], normal, MathConstructors.MakeSpace[$thick]]; rightSpace: Symbol _ MakeSymbol[$rightSpace, LIST[$aliasRightSpace], normal, MathConstructors.MakeSpace[$thick]]; RETURN[MakeCompoundClass[class, relation, description, LIST[lhsArg, rhsArg], LIST[relSym, leftSpace, rightSpace], FixedSizeBoxRule, RelationCompRule, cvtAS]]; }; <> wrongBoxType: PUBLIC ERROR = CODE; <> InstallListClassesAA: PROC [] ~ { <> parenClass, curlyClass, squareClass, listClass, unaryFunctionClass, binaryFunctionClass, ternaryFunctionClass, quaternaryFunctionClass, altFunctionClass, nullaryFunctionClass, quoteClass: CompoundClass; aParenArg, aCurlyArg, aSquareArg, carArg, cdrArg, fArg, arg1, arg2, arg3, arg4: Argument; leftParenSym, rightParenSym, leftCurlySym, rightCurlySym, leftSquareSym, rightSquareSym, commaSym, listSpSym, funSpaceSym, funLParenSym, funRParenSym, altFunLP, altFunRP, arg12SpaceSym, arg23SpaceSym, arg34SpaceSym, comma12Sym, comma23Sym, comma34Sym, leftQuoteSym, rightQuoteSym: Symbol; <> aParenArg _ MakeArgument[$a, LIST[$aliasA, $aliasHot], normal]; leftParenSym _ MakeSymbol[$leftParen, NIL, normal, MathConstructors.MakePlainSym['(]]; rightParenSym _ MakeSymbol[$rightParen, NIL, normal, MathConstructors.MakePlainSym[')]]; <> aCurlyArg _ MakeArgument[$a, LIST[$aliasA, $aliasHot], normal]; leftCurlySym _ MakeSymbol[$leftCurly, NIL, normal, MathConstructors.MakePlainSym['{]]; rightCurlySym _ MakeSymbol[$rightCurly, NIL, normal, MathConstructors.MakePlainSym['}]]; <> aSquareArg _ MakeArgument[$a, LIST[$aliasA, $aliasHot], normal]; leftSquareSym _ MakeSymbol[$leftSquare, NIL, normal, MathConstructors.MakePlainSym['[]]; rightSquareSym _ MakeSymbol[$rightSquare, NIL, normal, MathConstructors.MakePlainSym[']]]; <> leftQuoteSym _ MakeSymbol[$leftSquare, NIL, normal, MathConstructors.MakePlainSym['']]; rightQuoteSym _ MakeSymbol[$rightSquare, NIL, normal, MathConstructors.MakePlainSym['']]; <> carArg _ MakeArgument[$car, LIST[$aliasA, $aliasHot], normal]; cdrArg _ MakeArgument[$cdr, LIST[$aliasB], normal]; commaSym _ MakeSymbol[$comma, NIL, normal, MathConstructors.MakeItalSym[',]]; listSpSym _ MakeSymbol[$space, LIST[$aliasSpace], normal, MathConstructors.MakeSpace[$thick]]; <> fArg _ MakeArgument[$f, LIST[$aliasA], normal]; arg1 _ MakeArgument[$arg1, LIST[$aliasB, $aliasHot], normal]; arg2 _ MakeArgument[$arg2, NIL, normal]; arg3 _ MakeArgument[$arg3, NIL, normal]; arg4 _ MakeArgument[$arg4, NIL, normal]; <> <> funLParenSym _ MakeSymbol[$leftParen, NIL, normal, MathConstructors.MakePlainSym['[]]; funRParenSym _ MakeSymbol[$rightParen, NIL, normal, MathConstructors.MakePlainSym[']]]; altFunLP _ MakeSymbol[$leftParen, NIL, normal, MathConstructors.MakeSpace[$null]]; altFunRP _ MakeSymbol[$rightParen, NIL, normal, MathConstructors.MakeSpace[$null]]; funSpaceSym _ MakeSymbol[$funSpace, LIST[$aliasSpace], normal, MathConstructors.MakeSpace[$medium]]; arg12SpaceSym _ MakeSymbol[$arg12Space, NIL, normal, MathConstructors.MakeSpace[$medium]]; arg23SpaceSym _ MakeSymbol[$arg23Space, NIL, normal, MathConstructors.MakeSpace[$medium]]; arg34SpaceSym _ MakeSymbol[$arg34Space, NIL, normal, MathConstructors.MakeSpace[$medium]]; comma12Sym _ MakeSymbol[$comma12, NIL, normal, MathConstructors.MakeItalSym[',]]; comma23Sym _ MakeSymbol[$comma23, NIL, normal, MathConstructors.MakeItalSym[',]]; comma34Sym _ MakeSymbol[$comma34, NIL, normal, MathConstructors.MakeItalSym[',]]; <> <<>> <> listClass _ MakeCompoundClass[$list, other, "a, b", LIST[carArg, cdrArg], LIST[commaSym, listSpSym], FixedSizeBoxRule, ListCompRule, "($car, $cdr)", "{$car, $cdr}"]; -- these are binary, not n-ary, lists nullaryFunctionClass _ MakeCompoundClass[$nullaryFunction, other, "function()", LIST[fArg], LIST[funLParenSym, funRParenSym, funSpaceSym], FixedSizeBoxRule, NullaryFunctionCompRule, "$f []", "$f ()", "$f []"]; unaryFunctionClass _ MakeCompoundClass[$unaryFunction, other, "function(arg)", LIST[fArg, arg1], LIST[funSpaceSym, funLParenSym, funRParenSym], UnaryFunctionBoxRule, UnaryFunctionCompRule, "$f [$arg1]", "$f ($arg1)", "$f [$arg1]"]; binaryFunctionClass _ MakeCompoundClass[$binaryFunction, other, "function(arg1, arg2)", LIST[fArg, arg1, arg2], LIST[funSpaceSym, funLParenSym, comma12Sym, arg12SpaceSym, funRParenSym], BinaryFunctionBoxRule, BinaryFunctionCompRule, "$f [$arg1, $arg2]", "$f ($arg1, $arg2)", "$f [$arg1, $arg2]"]; ternaryFunctionClass _ MakeCompoundClass[$ternaryFunction, other, "function(arg1, arg2, arg3)", LIST[fArg, arg1, arg2, arg3], LIST[funSpaceSym, funLParenSym, comma12Sym, arg12SpaceSym, comma23Sym, arg23SpaceSym, funRParenSym], TernaryFunctionBoxRule, TernaryFunctionCompRule, "$f [$arg1, $arg2, $arg3]", "$f ($arg1, $arg2, $arg3)", "$f [$arg1, $arg2, $arg3]"]; quaternaryFunctionClass _ MakeCompoundClass[$quaternaryFunction, other, "function(arg1, arg2, arg3, arg4)", LIST[fArg, arg1, arg2, arg3, arg4], LIST[funSpaceSym, funLParenSym, comma12Sym, arg12SpaceSym, comma23Sym, arg23SpaceSym, comma34Sym, arg34SpaceSym, funRParenSym], QuaternaryFunctionBoxRule, QuaternaryFunctionCompRule, "$f [$arg1, $arg2, $arg3, $arg4]", "$f ($arg1, $arg2, $arg3, $arg4)", "$f [$arg1, $arg2, $arg3, $arg4]"]; altFunctionClass _ MakeCompoundClass[$altFunction, other, "function arg", LIST[fArg, arg1], LIST[altFunLP, altFunRP, funSpaceSym], FixedSizeBoxRule, UnaryFunctionCompRule, "(function $f $arg1)"]; parenClass _ MakeCompoundClass[$paren, paren, "( a )", LIST[aParenArg], LIST[leftParenSym, rightParenSym], ParenBoxRule, ParenCompRule, "( $a )", "( $a )", "( $a )"]; curlyClass _ MakeCompoundClass[$curly, paren, "{ a }", LIST[aCurlyArg], LIST[leftCurlySym, rightCurlySym], CurlyBoxRule, CurlyCompRule, "{ $a }"]; squareClass _ MakeCompoundClass[$square, paren, "[ a ]", LIST[aSquareArg], LIST[leftSquareSym, rightSquareSym], SquareBoxRule, SquareCompRule, "[ $a ]"]; quoteClass _ MakeCompoundClass[$quote, paren, "' a", LIST[aSquareArg], LIST[leftQuoteSym, rightQuoteSym], SquareBoxRule, SquareCompRule, "quote($a)"]; <> <<>> MathDB.InstallCompoundClass[parenClass]; MathDB.AddOperator[parenClass, $List]; MathDB.InstallCompoundClass[curlyClass]; MathDB.AddOperator[curlyClass, $List]; MathDB.InstallCompoundClass[squareClass]; MathDB.AddOperator[squareClass, $List]; <<*** 7/16/87 disable lists so Reduce list function treated as unknown func>> <> <> <<*** >> <<>> MathDB.InstallCompoundClass[quoteClass]; MathDB.AddOperator[quoteClass, $List]; MathDB.InstallCompoundClass[altFunctionClass]; MathDB.AddOperator[altFunctionClass, $List]; MathDB.InstallCompoundClass[nullaryFunctionClass]; MathDB.AddOperator[nullaryFunctionClass, $List]; MathDB.InstallCompoundClass[unaryFunctionClass]; MathDB.AddOperator[unaryFunctionClass, $List]; MathDB.InstallCompoundClass[binaryFunctionClass]; MathDB.AddOperator[binaryFunctionClass, $List]; MathDB.InstallCompoundClass[ternaryFunctionClass]; MathDB.AddOperator[ternaryFunctionClass, $List]; MathDB.InstallCompoundClass[quaternaryFunctionClass]; MathDB.AddOperator[quaternaryFunctionClass, $List]; }; InstallListClassesB: PROC [] ~ { <> assignmentClass: CompoundClass; <> <> <> assignmentClass _ MakeRelationClass[$assign, $assign, $lhs, $rhs, MathConstructors.MakePlainSym['\254], "a _ b", "$lhs _ $rhs", "$lhs := $rhs", "$lhs : $rhs"]; <<>> MathDB.InstallCompoundClass[assignmentClass]; MathDB.AddOperator[assignmentClass, $List]; <> <> }; <> InstallListClassesAA[]; InstallListClassesB[]; END.