Suppose we have list L1 of objects and we want to copy this list to another list, say L2.
If we just do L2 = L1 then this will not make an actual copy as any changes
to L1 are still reflected in L2. The above only copies the reference to the same
list.
To make a physical copy, need to use the copy command as follows
restart; module person_type() option object; export the_name::string:="doe joe"; export the_age::integer:=100; end module; L1:=[]; for N from 1 to 5 do o:=Object(person_type); o:-the_name:=convert(N,string); L1:= [ op(L1), o]; od: L2:=map(Z->copy(Z),L1):
Now making any changes to L1 will not affect L2. If we just did L2 = L1 then both will
share same content which is not what we wanted.