InstallListClassesAA:
PROC [] ~ {
local declarations
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;
define info for "( a )"
aParenArg ← MakeArgument[$a, LIST[$aliasA, $aliasHot], normal];
leftParenSym ← MakeSymbol[$leftParen, NIL, normal, MathConstructors.MakePlainSym['(]];
rightParenSym ← MakeSymbol[$rightParen, NIL, normal, MathConstructors.MakePlainSym[')]];
define info for "{ a }"
aCurlyArg ← MakeArgument[$a, LIST[$aliasA, $aliasHot], normal];
leftCurlySym ← MakeSymbol[$leftCurly, NIL, normal, MathConstructors.MakePlainSym['{]];
rightCurlySym ← MakeSymbol[$rightCurly, NIL, normal, MathConstructors.MakePlainSym['}]];
define info for "[ a ]"
aSquareArg ← MakeArgument[$a, LIST[$aliasA, $aliasHot], normal];
leftSquareSym ← MakeSymbol[$leftSquare, NIL, normal, MathConstructors.MakePlainSym['[]];
rightSquareSym ← MakeSymbol[$rightSquare, NIL, normal, MathConstructors.MakePlainSym[']]];
define info for quote(a)
leftQuoteSym ← MakeSymbol[$leftSquare, NIL, normal, MathConstructors.MakePlainSym['']];
rightQuoteSym ← MakeSymbol[$rightSquare, NIL, normal, MathConstructors.MakePlainSym['']];
define info for "$list $car $cdr"
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]];
define info for functions (parens also used by complex)
fArg ← MakeArgument[$f, LIST[$aliasA, $aliasHot], normal];
arg1 ← MakeArgument[$arg1, LIST[$aliasB], normal];
arg2 ← MakeArgument[$arg2, NIL, normal];
arg3 ← MakeArgument[$arg3, NIL, normal];
arg4 ← MakeArgument[$arg4, NIL, normal];
funLParenSym ← MakeSymbol[$leftParen, NIL, normal, MathConstructors.MakePlainSym['\050]];
funRParenSym ← MakeSymbol[$rightParen, NIL, normal, MathConstructors.MakePlainSym['\051]];
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[',]];
define compound classes
others
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)"];
Register compound classes in user-friendly order
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[listClass];
MathDB.AddOperator[listClass, $List];
***
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];
};