struct - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


MTM

  

struct

  

record constructor

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

struct(name1,value1,name2,value2,...);

Parameters

namei

-

name or string

valuei

-

any expression

Description

• 

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.

Examples

withMTM:

sstructa,1,b,2

s a: 1 b: 2

(1)

s:-a

1

(2)

See Also

exports

ModulePrint

MTM

Record