Skip to content

Commit e104064

Browse files
committed
Document use of () for installing methods for ops w/ low precedence
1 parent 76eed9f commit e104064

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

M2/Macaulay2/m2/help.m2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ getOperator := key -> if operator#?key then (
303303
"The user may install ", TO "Macaulay2Doc :: binary methods", " for handling such expressions with code such as"},
304304
PRE if key === symbol SPACE
305305
then " X Y := (x,y) -> ..."
306+
else if (getParsing key)#0 <= (getParsing symbol :=)#0
307+
then " (X "|op|" Y) := (x,y) -> ..."
306308
else " X "|op|" Y := (x,y) -> ...",
307309
PARA {"where ", TT "X", " is the class of ", TT "x", " and ", TT "Y", " is the class of ", TT "y", "."}},
308310
if key === symbol ?? then { -- can't install binary methods

M2/Macaulay2/packages/Macaulay2Doc/operators/assignment.m2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ document {
4545
},
4646
EXAMPLE lines ///
4747
installMethod(symbol <-, String, peek)
48-
///
48+
///,
49+
PARA { "The following syntax may also be used. Note that the parentheses on the left hand side are necessary because of the low precedence of the ",
50+
CODE "<-", " operator."},
51+
EXAMPLE "(<- String) := peek"
4952
),
5053
SYNOPSIS (
5154
Heading => "using installed assignment methods",

M2/Macaulay2/packages/Macaulay2Doc/operators/shift.m2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ document {
1919
Key => symbol >>,
2020
Headline => "a binary operator, used for bit shifting or attaching optional inputs to functions",
2121
SeeAlso => { (symbol >>, OptionTable, Function) },
22+
Caveat => {"Due to its low precedence, parentheses must be used on the left hand side when installing methods for this operator, e.g., ",
23+
CODE "(X >> Y) := f", "."},
2224
Subnodes => { TO "right shift" }
2325
}
2426

0 commit comments

Comments
 (0)