Question: Copy values of mutable content

What's the correct way of copying the current contents of a mutable object to a variable.

Apparently eval doesn't do the job.

aVectorList := [Vector(2, [1, 2]), Vector(2, [3, 2])]

[Vector[column](%id = 36893489518525866940), Vector[column](%id = 36893489518525867060)]

(1)

results := []

[]

(2)

AddVector := Vector(4)NULL

Vector[column](%id = 36893489518525846460)

(3)

for x in aVectorList do AddVector[1] := x[1]; AddVector[2] := x[2]; results := [op(results), AddVector] end do

AddVector[1] := 1

 

AddVector[2] := 2

 

[Vector(4, {(1) = 1, (2) = 2, (3) = 0, (4) = 0})]

 

AddVector[1] := 3

 

AddVector[2] := 2

 

[Vector[column](%id = 36893489518525846460), Vector[column](%id = 36893489518525846460)]

(4)

NULL

results := []

[]

(5)

AddVector := Vector(4)NULL

Vector[column](%id = 36893489518525840668)

(6)

NULL

for x in aVectorList do AddVector[1] := eval(x[1]); AddVector[2] := eval(x[2]); results := [op(results), AddVector] end do

AddVector[1] := 1

 

AddVector[2] := 2

 

[Vector(4, {(1) = 1, (2) = 2, (3) = 0, (4) = 0})]

 

AddVector[1] := 3

 

AddVector[2] := 2

 

[Vector[column](%id = 36893489518525840668), Vector[column](%id = 36893489518525840668)]

(7)

NULL

Download Mutable.mw

Please Wait...