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

Conversation

d-torrance
Copy link
Member

This fixes an old bug in the bugs directory. Previously, select didn't keep track of whether its input was mutable or not, even though it did keep track of the class. So we got immutable MutableList objects!

Before

i1 : L = new MutableList from {0, 1, 2}

o1 = MutableList{...3...}

o1 : MutableList

i2 : M = select(L, i -> true)

o2 = MutableList{...3...}

o2 : MutableList

i3 : M#0 = 4
stdio:3:5:(3): error: assignment attempted to element of immutable list

After

i3 : M#0 = 4

o3 = 4

i4 : peek M

o4 = MutableList{4, 1, 2}

This fixes a bug where "select" on a mutable list returned an object of
type MutableList with its Mutable flag off.
@DanGrayson DanGrayson merged commit a15de36 into Macaulay2:development May 16, 2024
6 checks passed
@d-torrance d-torrance deleted the select-mutable-list branch June 6, 2024 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants