Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve mutability in "select" #3237

Merged
merged 3 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions M2/Macaulay2/d/actors4.d
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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")
Expand Down
12 changes: 12 additions & 0 deletions M2/Macaulay2/tests/normal/mutable-lists.m2
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 0 additions & 11 deletions bugs/dan/0-select-mutable-list

This file was deleted.