dismantle - display a Maple data structure, optionally with addresses
|
Calling Sequence
|
|
dismantle(expr);
dismantle[hex](expr);
dismantle[dec](expr);
dismantle[oct](expr);
|
|
Parameters
|
|
expr
|
-
|
expression to display
|
|
|
|
|
Description
|
|
•
|
The dismantle functions display the structure of a Maple expression, showing each sub-expression, its length (in decimal), and optionally its address (in hexadecimal, decimal, or octal). The length corresponds to the number of terms in the sequence of addresses (see disassemble) of the sub-expression.
|
•
|
The dismantle[hex] function displays the addresses of each subexpression in hexadecimal, preceding the length.
|
•
|
The dismantle[dec] function displays the addresses of each subexpression in decimal, preceding the length.
|
•
|
The dismantle[oct] function displays the addresses of each subexpression in octal, preceding the length.
|
•
|
There are two additional options to dismantle that can be used in combination with the hex, dec, and oct options above to alter its behavior.
|
•
|
The dismantle[...,string] function outputs the dismantle data as a string rather than as output to the session.
|
•
|
The dismantle[...,address] function can be used with only a single argument that represents the address (see addressof) of the object to be dismantled. This is useful to display the structure of objects that cannot be passed as arguments (assignments for example).
|
•
|
The dismantle functions are intended as extra tools for the "hackware package". It is assumed that the user is familiar with Maple's internal representation, and can make use of the information provided by dismantle.
|
•
|
Maple names, integers, rationals, and floats are displayed on one line, as they would appear when typed or printed by lprint. For example, NAME(7): `This is a string`.
|
•
|
Local variables and parameters are displayed on one line, as the ordinal number of the variable or parameter in square brackets. For example, LOCAL(2): [3].
|
•
|
The exponents in a series are displayed on one line, as integers in square brackets.
|
•
|
A non-existent object (not to be confused with the Maple object NULL) is displayed as [NIL].
|
•
|
Other structures are printed as a header, followed by the components of the structure indented 3 spaces below the header.
|
•
|
The dismantle function is intended solely as an aid to debugging and/or understanding the internal structures of Maple. For example, it can be useful when writing external code using the OpenMaple API. As such, dismantle simply prints its output; it does not return a result. To produce an easily-manipulated inert form of a Maple structure, use ToInert instead.
|
|
|
Examples
|
|
>
|
f := proc(x) if x < 2 then x^2 else x^3 end if end proc:
|
>
|
|
>
|
|
PROC(11)
EXPSEQ(2)
NAME(4): x
EXPSEQ(1)
EXPSEQ(1)
EXPSEQ(1)
IF(4)
LESSTHAN(3)
PARAM(2): [1]
INTPOS(2): 2
PROD(3)
PARAM(2): [1]
INTPOS(2): 2
PROD(3)
PARAM(2): [1]
INTPOS(2): 3
EXPSEQ(1)
EXPSEQ(1)
EXPSEQ(1)
BINARY(2)
1
EXPSEQ(5)
LIST(2)
EXPSEQ(5)
INTPOS(2): 0
INTPOS(2): 1
INTPOS(2): 6
INTPOS(2): 55
LIST(2)
EXPSEQ(5)
INTPOS(2): 0
INTPOS(2): 1
INTPOS(2): 14
INTPOS(2): 46
LIST(2)
EXPSEQ(5)
INTPOS(2): 0
INTPOS(2): 1
INTPOS(2): 28
INTPOS(2): 32
LIST(2)
EXPSEQ(5)
INTPOS(2): 0
INTPOS(2): 1
INTPOS(2): 37
INTPOS(2): 41
| |
>
|
|
| (1) |
>
|
|
SUM(100002AAAAE8A5CA6,5)
PROD(100002AAAAEB87EB6,3)
SUM(100002AAAAE8A5C56,5)
NAME(100002AAAAE889EFE,4): a
INTPOS(10000000000000001,2): 1
NAME(100002AAAAE89427E,4): b
INTPOS(10000000000000001,2): 1
INTPOS(10000000000000003,2): 2
INTPOS(10000000000000001,2): 1
PROD(100002AAAAEB87ECE,3)
SUM(100002AAAAE8A5C56,5)
NAME(100002AAAAE889EFE,4): a
INTPOS(10000000000000001,2): 1
NAME(100002AAAAE89427E,4): b
INTPOS(10000000000000001,2): 1
INTPOS(10000000000000005,2): 3
INTPOS(10000000000000001,2): 1
| |
>
|
|
| (2) |
An assignment
>
|
|
| (3) |
>
|
|
ASSIGN(3)
NAME(4): a
NAME(4): b
| |
>
|
|
| (4) |
|
|