diff --git a/M2/Macaulay2/d/actors4.d b/M2/Macaulay2/d/actors4.d index 4a35d1fa3b0..86225ad118d 100644 --- a/M2/Macaulay2/d/actors4.d +++ b/M2/Macaulay2/d/actors4.d @@ -156,7 +156,7 @@ select(e:Expr,f:Expr):Expr := ( c := select(b.v,f); when c is Error do c - is v:Sequence do list(b.Class,v) + is v:Sequence do list(b.Class,v,b.Mutable) else e -- shouldn't happen ) is n:ZZcell do ( @@ -221,7 +221,7 @@ select(n:Expr,e:Expr,f:Expr,g:Expr,h:Expr):Expr := ( c := select(toInt(n),b.v,f); when c is Error do c - is v:Sequence do list(b.Class,v) + is v:Sequence do list(b.Class,v,b.Mutable) else e -- shouldn't happen ) else WrongArg(1+1,"a list") diff --git a/M2/Macaulay2/tests/normal/mutable-lists.m2 b/M2/Macaulay2/tests/normal/mutable-lists.m2 new file mode 100644 index 00000000000..3d4e689cb17 --- /dev/null +++ b/M2/Macaulay2/tests/normal/mutable-lists.m2 @@ -0,0 +1,12 @@ +-- select w/ mutable lists +M = new MutableList from 1..10 +M' = select(M, even) +assert Equation(#M', 5) +for i to 4 do assert Equation(M'#i, 2*(i + 1)) +M'#0 = 5 +assert Equation(M'#0, 5) +M'' = select(3, M, even) +assert Equation(#M'',3) +for i to 2 do assert Equation(M''#i, 2*(i + 1)) +M''#0 = 5 +assert Equation(M''#0, 5) diff --git a/bugs/dan/0-select-mutable-list b/bugs/dan/0-select-mutable-list deleted file mode 100644 index c76a8c244ed..00000000000 --- a/bugs/dan/0-select-mutable-list +++ /dev/null @@ -1,11 +0,0 @@ -run this and get - - L = new MutableList from {0,1,2} - M = select(L, i->true) - M#0 = 4 - N = new MutableList from toList M - N#0 = 4 - -stdio:5:5:(3): error: assignment attempted to element of immutable list - -Should select even return a mutable list?