dismantle - Maple Help

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 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.

Examples

 > f := proc(x) if x < 2 then x^2 else x^3 end if end proc:
 > $\mathrm{dismantle}\left(f\right)$
 NAME(4): f
 > $\mathrm{dismantle}\left(\mathrm{op}\left(f\right)\right)$
 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≔{\left(a+b\right)}^{2}+{\left(a+b\right)}^{3}$
 ${f}{≔}{\left({a}{+}{b}\right)}^{{2}}{+}{\left({a}{+}{b}\right)}^{{3}}$ (1)
 > $\mathrm{dismantle}\left[\mathrm{hex}\right]\left(f\right)$
 SUM(200007F262B809F4C,5)    PROD(200007F262B83CEE4,3)       SUM(200007F262B809EFC,5)          NAME(200007F262B505DFC,4): a          INTPOS(1FFFFFFFFFFFFFFFF,2): 1          NAME(200007F262B7BC6DC,4): b          INTPOS(1FFFFFFFFFFFFFFFF,2): 1       INTPOS(20000000000000001,2): 2    INTPOS(1FFFFFFFFFFFFFFFF,2): 1    PROD(200007F262B83CEFC,3)       SUM(200007F262B809EFC,5)          NAME(200007F262B505DFC,4): a          INTPOS(1FFFFFFFFFFFFFFFF,2): 1          NAME(200007F262B7BC6DC,4): b          INTPOS(1FFFFFFFFFFFFFFFF,2): 1       INTPOS(20000000000000003,2): 3    INTPOS(1FFFFFFFFFFFFFFFF,2): 1
 > $\mathrm{dismantle}\left[\mathrm{hex},\mathrm{string}\right]\left(f\right)$
 ${"SUM\left(200007F262B809F4C,5\right) PROD\left(200007F262B83CEE4,3\right) SUM\left(200007F262B809EFC,5\right) NAME\left(200007F262B505DFC,4\right): a INTPOS\left(1FFFFFFFFFFFFFFFF,2\right): 1 NAME\left(200007F262B7BC6DC,4\right): b INTPOS\left(1FFFFFFFFFFFFFFFF,2\right): 1 INTPOS\left(20000000000000001,2\right): 2 INTPOS\left(1FFFFFFFFFFFFFFFF,2\right): 1 PROD\left(200007F262B83CEFC,3\right) SUM\left(200007F262B809EFC,5\right) NAME\left(200007F262B505DFC,4\right): a INTPOS\left(1FFFFFFFFFFFFFFFF,2\right): 1 NAME\left(200007F262B7BC6DC,4\right): b INTPOS\left(1FFFFFFFFFFFFFFFF,2\right): 1 INTPOS\left(20000000000000003,2\right): 3 INTPOS\left(1FFFFFFFFFFFFFFFF,2\right): 1"}$ (2)

An assignment

 > $f≔\mathrm{assemble}\left(\mathrm{kernelopts}\left(\mathrm{dagtag}=\mathrm{ASSIGN}\right),\mathrm{addressof}\left(a\right),\mathrm{addressof}\left(b\right)\right)$
 ${f}{≔}{36893627949286333076}$ (3)
 > $\mathrm{dismantle}\left[\mathrm{address}\right]\left(f\right)$
 ASSIGN(3)    NAME(4): a    NAME(4): b
 > $\mathrm{eval}\left(\mathrm{pointto}\left(f\right)\right)$
 ${b}$ (4)