up previous next
is any CoCoA object and
a string, then the function
returns the object
tagged with the string
The returned object is then of type
, the tag string of an object,
and the function
original object, stripped of its tag.
This is the way to add a new type at run-time.
/**/ L := ["Dave", "March 14, 1959", 372];
/**/ M := Tagged(L, "MiscData"); -- L tagged with the string "MiscData"
/**/ type(L); -- L is a list
/**/ type(M); -- M is a tagged object
/**/ --M; -- Until a special print function is defined, the printing of M
-- is the same as L (with a WARNING)
--> WARNING: Cannot find "$BackwardCompatible.PrintTagged", so I'm implicitly untagging the value
--> ["Dave", "March 14, 1959", 372]
The next section explains how to define functions for pretty printing
of tagged objects.