 system("reference"); system("shared");
ring r = 0, (x,y,z), dp;
poly p = x + y + z;
shared xsh = x;
subst(p, xsh,1, y,2, z,3); // fails
==> ? subst(`poly`,`shared`,`int`) failed
==> ? expected subst(`poly`,`poly`,`poly`)
==> ? expected subst(`matrix`,`poly`,`int`)
==> ? error occurred in or before ./examples/reference_and_shared_operatio\
ns_1.sing line 5: `subst(p, xsh,1, y,2, z,3); // fails`
subst(p, poly(xsh),1, y,2, z,3); // good
==> 6
subst(p, link(xsh),1, y,2, z,3); // fine
==> 6
list ll = list(xsh, xsh, xsh);
ll[1] = y; // replaced only first entry
ll;
==> [1]:
==> y
==> [2]:
==> x
==>
==> [3]:
==> x
==>
shared(ll[2]) = z; // replaces the others
ll;
==> [1]:
==> y
==> [2]:
==> z
==>
==> [3]:
==> z
==>
def(ll[2]) = x; // generic alternative
ll;
==> [1]:
==> y
==> [2]:
==> x
==>
==> [3]:
==> x
==>
