3 Interactive Examination

Once a value is displayed, it can be examined more closely by using the context menus attached to its nodes. A node's context menu offers a configurable set of type-specific operations on that node and can be opened by right-clicking the node's so-called access point.

3.1 Node Access Points

Node access points are defined as follows:

3.2 Node Operations

The Inspector offers three types of operations on nodes: exploration, filtering and mapping, and actions (see Figure 3.1).

Figure 3.1: A context menu opened over the closing parenthesis

These types of operations are explained in the following sections.

3.2.1 Exploration

When inspecting a large data structure, one often needs to zoom in on a subvalue or hide currently irrevelant data. This is what the exploration operations are intended for. Two different kinds of operations exist, for modifying the depth and the width limits respectively (see Figure 3.2).

Figure 3.2: Sample inspection and various results


Applying the operation ``Depth +n'' to a node causes the subtree starting at that node to be redrawn, with a depth of n levels. Applying the operation ``Depth -n'' causes the node to be pruned, as well as its n - 1 parent nodes. The effect of the global depth limit is that when new values are inspected, immediately the operation ``Depth +d'' is applied to them, where d is the global depth limit.


Every node also has a display width associated with it. If a node has a display width w, only its first w subtrees will be displayed (in the case that w is zero, that means none). Initially, all nodes are created with the default display width. Applying the operation ``Width +n'' or ``Width -n'' to a node modifies that node's display width by the specified amount and causes it to be redrawn accordingly.

Figure 3.2 shows some examples of the effects of the operations described above. They have all been obtained from inspecting the sample tuple given above, and applying operations to it as follows:

  1. The sample tuple has been shrinked by applying ``Width -5''.

  2. The sample tuple has been subject to applying ``Width -5'' once and ``Width +1'' twice.

  3. The sample tuple has been collapsed by applying ``Depth -1''.

  4. The sample tuple is only partially displayed when applying ``Depth +1''. Note that the operation does not augment the display depth, but replaces it.

  5. The sample tuple has been partially displayed using ``Depth +1'' and then shrinked in width by applying ``Width -1'' twice. This shows that the exploration functions are compositional.

3.2.2 Filtering and Mapping

The Inspector defines default mappings for many data types, to perform commonly-used operations such as inspecting the state of mutable data structures. Figure 3.3 demonstrates an example of this: By default, dictionaries are displayed as the unspecific tag <dictionary>. The default mapping ``Show Items'' for dictionaries replaces the dictionary node by a snapshot of its contents (specifically, as the result of the Dictionary.items procedure).

Figure 3.3: Example mapping invocation and its result

Note how the different choice of background color indicates that this is, in fact, a mapped representation. Mappings can be undone using the context menu option ``unmap''.

Mappings have the following properties:

Mapping functions can be applied automaticly before inspection of the value. See Section 4.1 for details on how to do this. Keep in mind that the results can be confusing due to the per-node mapping strategy.

3.2.3 Triggering Actions

Figure 3.4 demonstrates the invocation of an action. The by-need future is forced, whereupon the Inspector will update its display accordingly, showing its value.

Figure 3.4: Example action invocation and its result

Like mappings, actions are type-specific. See Section 5.5.3 for details on how to register new actions.

3.3 Using Selections

Some of the operations presented above can also be triggered on the selected node by the ``Selection'' menu. To ``select'' a node means to left-click a node access point: The corresponding node will be drawn with a selection frame around it. Figure 3.5 shows the operations that can be applied to the selected node.

Figure 3.5: The selection interface

3.3.1 Substructure Lifting

Figure 3.6 demonstrates another application of selections: Any selected substructure can be lifted to toplevel by applying the ``Clear all but Selection'' command from the Inspector menu.

Figure 3.6: Substructure lifting

Substructure lifting is intended to rapidly prune large trees and currently works only with one structure selection. It cannot be undone.

Thorsten Brunklaus
Version 1.4.0 (20080702)