up previous next
shape    --    extended list of types involved in an expression


Syntax
shape(E: LIST): LIST (of TYPE)
shape(E: RECORD): RECORD (of TYPE)
shape(E:OTHER): TYPE

Description
shape behaves like type except for LIST and RECORD, where shape recurses into the structure.
LIST:  gives [shape(obj) | obj in E]

RECORD: gives record[field1 := shape(E.field1), ... ]
        retaining the original field names


Example
/**/  use R ::= QQ[x];
/**/  L := [1,[1,"a"], x^2-x];
/**/  shape(L);
[INT, [INT, STRING], RINGELEM]

/**/  R := record[name := "test", contents := L];
/**/  shape(R);
record[contents := [INT, [INT, STRING], RINGELEM], name := STRING]

See Also