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

Online Help

All Products    Maple    MapleSim


convert/record

convert an expression to a record

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

convert( e, 'record' )

convert( e, 'record'['packed'],  'deep' )

Parameters

e

-

expression

Description

• 

The calling sequence convert( e, 'record' ) converts the expression e to a record.

• 

The input expression e must be a module without local variables, a list of equations whose left-hand sides are symbols, or a table all of whose indices are symbols. No other expression may be converted to a record.

• 

The calling sequence convert( e, 'record', 'deep' ) converts the table e to a record and any entries of e that are tables are also converted to records recursively. The deep option works only for tables.

  

Note: If the input expression e is a record, then it is returned unchanged.

• 

If the input expression e is a module, then it must not have non-exported local variables to be converted to a record. The resulting record has the names of the module exports as slot names, and their assigned values (if any) as the corresponding slot values.

• 

A list of equations of the form [name1=value1,name2=value2,...,namek=valuek] may be converted to a record. Each left-hand side namei must be a symbol. In this case, the resulting record is precisely the one that would be obtained by calling the Record constructor with the given equations as arguments.

• 

If the input expression e is a table, then every one among its indices must be a symbol. The resulting record has the table indices as slot names, and the corresponding tabular values as the record slot values.

• 

In any calling sequence, you can optionally use 'record'['packed'] in place of 'record' to specify that the output will be a packed Record.

Examples

rRecorda=1,b=2

rRecorda=1,b=2

(1)

typer,record

true

(2)

convertr,record

Recorda=1,b=2

(3)

mmodule_exporta,b;a1;b2end module:

convertm,record

Recorda=1,b=2

(4)

mmodule_exporta,b;_localu;a1;b2;u3end module:

Attempting to convert a module with a local variable to a record results in an error.

convertm,record

Error, (in `convert/record`) cannot convert a module with locals to a record

converta=1,b=2,record

Recorda=1,b=2

(5)

converttablea=1,b=2,record

Recorda=1,b=2

(6)

converttablea=1,b=2,recordpacked

Recordpackeda=1,b=2

(7)

converttablea=1,b=tabled=3,e=tablef=5,record

Recorda=1,b=tabled=3,e=tablef=5

(8)

Compatibility

• 

The convert/record command was updated in Maple 2020.

• 

The deep option was introduced in Maple 2020.

• 

For more information on Maple 2020 changes, see Updates in Maple 2020.

See Also

Record

type/record