| newstruct("nt","int a,poly b,string c");
nt A;
nt B;
A.a=3;
A.c=string(A.a);
B=A;
newstruct("t2","nt","string c");
t2 C; C.c="t2-c";
A=C;
typeof(A);
==> t2
A;
==> c=t2-c
==> c=
==> b=<poly>
==> a=0
// a motivating example ------------------------------------------
newstruct("IDEAL","ideal I,proc prettyprint");
newstruct("HOMOGENEOUS_IDEAL","IDEAL","intvec weights,proc prettyprint");
proc IDEAL_pretty_print(IDEAL I)
{
"ideal generated by";
I.I;
}
proc H_IDEAL_pretty_print(HOMOGENEOUS_IDEAL I)
{
"homogeneous ideal generated by";
I.I;
"with weights";
I.weights;
}
proc p_print(IDEAL I) { I.prettyprint(I); }
ring r;
IDEAL I;
I.I=ideal(x+y2,z);
I.prettyprint=IDEAL_pretty_print;
HOMOGENEOUS_IDEAL H;
H.I=ideal(x,y,z);
H.prettyprint=H_IDEAL_pretty_print;
H.weights=intvec(1,1,1);
p_print(I);
==> ideal generated by
==> _[1]=y2+x
==> _[2]=z
p_print(H);
==> homogeneous ideal generated by
==> _[1]=x
==> _[2]=y
==> _[3]=z
==> with weights
==> 1,1,1
|