Skip to content

Commit fffd641

Browse files
committed
Update parallel assignment docs
We don't actually give any new examples for = and := since "multiple" assignment is documented before the other uses of these operators, so it would seem out of order. But we do mention that it's possible to use it.
1 parent 5a585fd commit fffd641

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ document {
183183
(x,y) = f 9
184184
x
185185
y
186-
///
186+
///,
187+
PARA {"Multiple assignment may also be used for other uses of ", CODE "=",
188+
" such as assigning to elements of mutable lists and hash tables and using/installing assignment methods."}
187189
},
188190
SYNOPSIS {
189191
Heading => "assignment to an element of a mutable list",
@@ -485,21 +487,16 @@ document {
485487
Consequences => {
486488
{ "new local variables ", TT "x", ", ", TT "y", ", ", TT "z", ", ... are created" },
487489
{ "the expressions c,d,e,... are assigned to the variables x,y,z,..., respectively, as above." },
488-
{ "If the left hand side has more elements than the right hand side, then the extra symbols on the left side are given the value ", TO "null", "." },
489-
{ "If the left hand side has fewer elements than the right hand side, then the last symbol on the left hand side is given
490-
as value a sequence containing the trailing elements of the right hand side."
491-
},
492-
{ "If the right hand side is not a sequence, then it is assigned to the first symbol on the left, and the remaining symbols are assigned the
493-
value ", TO "null", "."
494-
}
490+
{ "the number of expressions must match the number of variables." }
495491
},
496492
PARA "Multiple assignment effectively means that functions can return multiple values usefully.",
497493
EXAMPLE lines ///
498494
f = i -> (i,i^2)
499495
(r,s) := f 9
500496
r
501497
s
502-
///
498+
///,
499+
PARA {"Multiple assignment may also be used for other uses of ", CODE ":=", " such as method installation."},
503500
},
504501
SYNOPSIS {
505502
Heading => "installing methods for binary operators",

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ doc ///
1818
Example
1919
importFrom(Core, "augmentedAssignmentOperators");
2020
augmentedAssignmentOperators
21+
Text
22+
Multiple augmented assignment is also supported.
23+
Example
24+
(x,y) = (3, 4)
25+
(x,y) += (5, 6)
26+
(x,y)
2127
SeeAlso
2228
"installing augmented assignment methods"
2329
///

0 commit comments

Comments
 (0)