Skip to content

Commit

Permalink
undocument a bunch of expression methods, cf Macaulay2#1668
Browse files Browse the repository at this point in the history
  • Loading branch information
pzinn committed Jul 25, 2024
1 parent a7a2f1f commit 5191992
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
12 changes: 7 additions & 5 deletions M2/Macaulay2/m2/expressions.m2
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ lprec = prec = x -> (getParsing x)#0
rprec = strength2 = x -> (getParsing x)#1
uprec = strength1 = x -> (getParsing x)#2

-- local variables
EmptyName := symbol EmptyName
unit := symbol unit
operator := symbol operator
EmptyName = symbol EmptyName
unit = symbol unit
operator = symbol operator
protect unit
protect operator
protect EmptyName
-*
letters := set characters "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'"
digits := set characters "0123456789"
Expand Down Expand Up @@ -433,7 +435,7 @@ expressionValue Adjacent := x -> (expressionValue x#0) (expressionValue x#1)
-----------------------------------------------------------------------------
prepend0 := (e,x) -> prepend(unhold e, x)
append0 := (x,e) -> append(x, unhold e)
assocList := {Sum,Product,DirectSum,TensorProduct,Equation} -- populate automatically?
assocList = {Sum,Product,DirectSum,TensorProduct,Equation} -- populate automatically?
scan(assocList, opClass -> (
installMethod(opClass#operator,opClass,opClass,join);
installMethod(opClass#operator,opClass,Expression,append);
Expand Down
12 changes: 0 additions & 12 deletions M2/Macaulay2/packages/Macaulay2Doc/doc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ undocumented {
(symbol *, Number, RingElement),
(symbol *, RingElement, Number),
(symbol*, Minus, Expression),
(symbol*, Product, Holder),
(symbol*, Minus, Minus),
(symbol*, Number, InfiniteNumber),
(symbol*, InfiniteNumber, ZZ),
Expand All @@ -35,14 +34,10 @@ undocumented {
(symbol*, ZZ, GradedModuleMap),
(symbol*, InfiniteNumber, InfiniteNumber),
(symbol*, Expression, Minus),
(symbol*, Product, Product),
(symbol*, Holder, Product),
(symbol*, ZZ, Module),
(symbol*, ZZ, MonomialIdeal),
(symbol*, String),
(symbol*, ZZ, ChainComplexMap),
(symbol*, Expression, OneExpression),
(symbol*, OneExpression, Expression),
}


Expand Down Expand Up @@ -893,7 +888,6 @@ document {

undocumented {
(symbol**, QuotientRing, PolynomialRing),
-- (symbol**, Expression, NonAssociativeProduct),
(symbol**, QuotientRing, QuotientRing),
(symbol**, Number, Matrix),
(symbol**, Matrix, Number),
Expand All @@ -902,14 +896,8 @@ undocumented {
(symbol **,RingElement,Number),
(symbol **,RingElement,RingElement),
(symbol **,Thing,InexactFieldFamily),
-- (symbol**, NonAssociativeProduct, NonAssociativeProduct),
(symbol**, PolynomialRing, PolynomialRing),
(symbol**, PolynomialRing, QuotientRing),
-- (symbol**, NonAssociativeProduct, Expression),
-- (symbol**, NonAssociativeProduct, Holder),
-- (symbol**, Holder, NonAssociativeProduct),
(symbol**, Expression, OneExpression),
(symbol**, OneExpression, Expression)
}

document {
Expand Down
25 changes: 19 additions & 6 deletions M2/Macaulay2/packages/Macaulay2Doc/doc12.m2
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,26 @@ document {
there is just one instance, an expression representing the number 1."
}

operator:= core "operator"
unit:=core "unit"
undocumented splice apply(core "assocList", opClass -> (
(opClass#operator,opClass,opClass),
(opClass#operator,opClass,Expression),
(opClass#operator,opClass,Holder),
(opClass#operator,Expression,opClass),
(opClass#operator,Holder,opClass),
(opClass#operator,Expression,Expression),
(opClass#operator,Expression,Thing),
(opClass#operator,Thing,Expression))
| if opClass#?unit then (
(opClass#operator,Expression,opClass#unit),
(opClass#operator,opClass#unit,Expression),
(opClass#operator,opClass,opClass#unit),
(opClass#operator,opClass#unit,opClass)
) else ())

undocumented {
(symbol -, Thing, Minus),
(symbol +, Sum, Sum),
(symbol +, Sum, Holder),
(symbol +, Holder, Sum),
(symbol +, ZeroExpression, Expression),
(symbol +, Expression, ZeroExpression),
(symbol -, Thing, Minus)
}

expressionMethodKeys := flatten apply(toList core "expressionBinaryOperators", op -> {
Expand Down

0 comments on commit 5191992

Please sign in to comment.