INFS2140/INFS3141 Advanced M/Caché ObjectScript Programming
RMU C&IS – Drawing Array Structure Diagrams


Drawing conventions for M Array Structure Diagrams (in /Caché ObjectScript and GT.M)


This diagram (seven nodes) is the result of the following five SETs:

SET ^R(2,41)=36,^R(17)=5,^R(17,6)=2,^R(17,8)=62,^R(17,34)=14


Most common ways to read these references out loud:

^R “up-arrow R”

^R(2) “up-arrow R sub 2”

^R(2,17) “up-arrow R sub 2 comma 17”

The use of “up-arrow” comes historically from the keyboard of the Digital PDP-11, which had an “up-arrow” ­ above the 8 where the caret symbol is today.


Note: there is no explicit set command to establish nodes ^R or ^R(2), they are implicitly established with no stored value by the command SET ^R(2,41)=36


What will the $DATA function return for each of these nodes? (0, 1, 10, 11)

What will the $DATA function return for this node? (0, 1, 10, 11)


Notes on the $DATA function:

The two questions to ask regarding a node (in order to know $DATA function result for that node) are:


$DATA results

No descendents

Has descendents

No stored value

Node doesn’t exist
$DATA returns 0

Intermediate or root node:
no stored value;
reference only

Has stored value

Leaf node or only node
$DATA returns 1

Intermediate or root node:
has stored value


Notes on array structure:


Notes on the diagram:


Updated: 2012-10-08 $H 62738

Valerie J. H. Powell, R.T.(R), Ph.D.

© 2012 by Robert Morris University