up previous next
3.7.9 Describing a Tagged Object
|
***** NOT YET UPDATED TO CoCoA-5: follow with care *****
If the object E is tagged with the string S, then when the user
enters the command
Describe E
, CoCoA first looks for a user-defined
function with name
Describe_S
and executes it; if not found, the
output depends on the type of Untagged(E).
Use R ::= QQ[x,y,z];
I := Ideal(x-y^2, x-z^3);
I := Tagged(I,"MyIdeals"); -- I is now tagged with "MyIdeals"
Describe I; -- the default description of an ideal
Record[Type := IDEAL, Value := Record[Gens := [-y^2 + x, -z^3 + x]]]
-------------------------------
Define Describe_MyIdeals(X)
Y := Untagged(X);
PrintLn "The generators are:";
Foreach G In Y.Gens Do
PrintLn" ", G;
EndForeach;
EndDefine;
Describe I; -- Any object tagged with "MyIdeals" is now described
-- using "Describe_MyIdeals".
The generators are:
-y^2 + x
-z^3 + x
-------------------------------
|