Skip to content

Commit f2ea270

Browse files
committed
Allow all types of list on the RHS of parallel assignment
1 parent facd3f7 commit f2ea270

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

M2/Macaulay2/d/evaluate.d

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,8 +1206,12 @@ parallelAssignmentFun(x:parallelAssignmentCode):Expr := (
12061206
when value is a:Sequence do (
12071207
-- unless y is a sequence of length 1, then it behaves like x = y#0
12081208
if length(a) == 1 then nothing
1209-
else value = ParallelAssignmentError(1))
1209+
else return ParallelAssignmentError(1))
1210+
is a:List do (
1211+
if length(a.v) == 1 then nothing
1212+
else return ParallelAssignmentError(1))
12101213
else value = seq(value));
1214+
when value is a:List do value = Expr(a.v) else nothing;
12111215
when value
12121216
is values:Sequence do (
12131217
if nlhs == length(values) then (

M2/Macaulay2/tests/normal/parallel.m2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ assert Equation(() = (), ())
112112
assert Equation(() := (), ())
113113
assert Equation(() += (), ())
114114

115+
-- other types of list on RHS
116+
(x, y, z) = {1, 2, 3}
117+
assert Equation((x, y, z), (1, 2, 3))
118+
(x, y, z) = [4, 5, 6]
119+
assert Equation((x, y, z), (4, 5, 6))
120+
(x, y, z) = <|7, 8, 9|>
121+
assert Equation((x, y, z), (7, 8, 9))
122+
(x) = {10}
123+
assert Equation(x, 10)
124+
115125
end
116126
-- Local Variables:
117127
-- compile-command: "make -C $M2BUILDDIR/Macaulay2/packages/Macaulay2Doc/test parallel.out"

0 commit comments

Comments
 (0)