dismantle
display a Maple data structure, optionally with addresses
Calling Sequence
Parameters
Description
Examples
dismantle(expr);
dismantle[hex](expr);
dismantle[dec](expr);
dismantle[oct](expr);
expr
-
expression to display
The dismantle functions display the structure of a Maple expression, showing each subexpression, 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 subexpression.
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.
f := proc(x) if x < 2 then x^2 else x^3 end if end proc:
dismantle⁡f
NAME(4): f
dismantle⁡op⁡f
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) 0x1 EXPSEQ(5) LIST(2) EXPSEQ(6) INTPOS(2): 0 INTPOS(2): 1 INTPOS(2): 6 INTPOS(2): 55 INTPOS(2): 36 LIST(2) EXPSEQ(6) INTPOS(2): 0 INTPOS(2): 1 INTPOS(2): 14 INTPOS(2): 48 INTPOS(2): 45 LIST(2) EXPSEQ(6) INTPOS(2): 0 INTPOS(2): 1 INTPOS(2): 28 INTPOS(2): 32 INTPOS(2): 14 LIST(2) EXPSEQ(6) INTPOS(2): 0 INTPOS(2): 1 INTPOS(2): 37 INTPOS(2): 41 INTPOS(2): 14
f≔a+b2+a+b3
dismantlehex⁡f
SUM(7FEC6F12AE88,5) PROD(7FEC6F147618,3) SUM(7FEC6F12AE38,5) NAME(7FEC6EE02EE0,4): a INTPOS(3,2): 1 NAME(7FEC6F0C6B80,4): b INTPOS(3,2): 1 INTPOS(5,2): 2 INTPOS(3,2): 1 PROD(7FEC6F147630,3) SUM(7FEC6F12AE38,5) NAME(7FEC6EE02EE0,4): a INTPOS(3,2): 1 NAME(7FEC6F0C6B80,4): b INTPOS(3,2): 1 INTPOS(7,2): 3 INTPOS(3,2): 1
dismantlehex,string⁡f
An assignment
f≔assemble⁡kernelopts⁡dagtag=ASSIGN,addressof⁡a,addressof⁡b
f≔36893628800740057204
dismantleaddress⁡f
ASSIGN(3) NAME(4): a NAME(4): b
eval⁡pointto⁡f
b
See Also
addressof
assemble
debugger
disassemble
kernelopts
pointto
ToInert
Download Help Document