2.6.1 Introduction to RECORD |
Example |
/**/ use R ::= QQ[x,y,z]; /**/ P := record[ I := ideal(x,y^2-z), F := x^2 + y, Misc := [1,3,4]]; /**/ P.I; ideal(x, y^2 -z) /**/ P["I"]; ideal(x, y^2 -z) /**/ P.Misc; [1, 3, 4] /**/ P.Misc[2]; 3 /**/ P.Date := "1/1/98"; /**/ indent(P); record[ Date := "1/1/98", F := x^2 +y, I := ideal(x, y^2 -z), Misc := [1, 3, 4] ] /**/ P["Misc",3]; -- equivalent to P.Misc[3] 4 |
Example |
/**/ P := record[A := 2, B := 3, C := 5, D := 7]; /**/ Q := record[]; Foreach F In Fields(P) Do If F <> "C" Then Q[F] := P[F]; EndIf; EndForeach; /**/ P := Q; /**/ P; record[A := 2, B := 3, D := 7] |