MTM
struct
record constructor
Calling Sequence
Parameters
Description
Examples
struct(name1,value1,name2,value2,...);
namei
-
name or string
valuei
any expression
The struct command creates a Maple record. A record is a fixed-size collection of items addressable by name. Accessing individual field values is done via the :- or [] operators. For example MyStruct:-field1 will give you value1 as does MyStruct[field1].
The :- operator binds more tightly than [], avoiding evaluation if the name field1 happens to have another meaning in the given scope. Conversely, [] allows evaluation to happen, which allows for name resolution, and iteration over individual fields via the exports command.
The struct command is essentially a front end to the Record command. Aside from the different calling sequence, the struct command differs from the Record command in that it adds a ModulePrint definition so the record is displayed nicely.
with⁡MTM:
s≔struct⁡a,1,b,2
s≔ a: 1 b: 2
s:-a
1
See Also
exports
ModulePrint
Record
Download Help Document