Talk:Display an outline as a nested table

From Rosetta Code

Why display an outline as a table ?

The current Perl6 draft expresses some helpful puzzlement about this :-)

The answer is that there are two quite different modes of outline – topic nests and propositional nests.

  1. Sub-topics nested inside the topics which they sub-divide – the classic serially-labelled TOC pattern which the Perl 6 entry is showing.
  2. Supporting points nested under the key points which they support or clarify.


(And it may well be that the task example could helpfully be replaced by a clearer example of the latter)

When the outline expresses propositional hierarchies (rather than sub-divisions of domains), indented lines ('outlines') have two disadvantages:

  1. Logically connected peers are visually driven further and further apart as subordinate elaboration expands, and cognitive work is required to reconnect the 'sentences' which they form when read together.
  2. The 'vertical' metaphor of support (evidence supporting claim, example supporting clarity etc etc) is replaced by a visually less direct horizontal convention, and, again, takes some cognitive work to reconstruct.


A potential *weakness* of tabular representations of argument/exposition structures is, of course, that some horizontal contiguities are more meaningful than others. One solution is to add more space at the margins where the edges of sub-trees meet, and another is to distinguish adjacent subtrees by color – hence the extra credit task of using color to reveal the borders between sub-trees.

In short, tabular representation can be very useful in:

  1. the visual presentation of nested key points and supporting points (rather than sub-divided topics)
  2. and the teaching of argument structure.


(The current Perl6 color scheme rather helpfully shows that I failed to make this at all obvious or clear :-) Thank you ! Hout (talk) 04:36, 24 October 2019 (UTC)

When an outline is more a forest than a tree

The test sample here is an outline with only one top level root node – we can think of it as representing a single tree.

In practice, of course, an indented text outline will often have several top level (unindented) lines. To put it another way, many outlines represent forests – lists of trees – rather than single trees (or can otherwise be thought of as a single tree with a hidden virtual root).

FWIW I've updated the Haskell, JavaScript and Functional Python versions here to allow for the forest case by writing out a series of (wiki) tables, one for each tree, separated by a couple of linefeeds. Hout (talk) 15:19, 6 September 2021 (UTC)

For example, a forest outline – with several top-level nodes – like:

alpha
    beta
    gamma
delta
    epsilon
    zeta
eta
    theta
    iota

might be rendered by the following sequence of space-separated tree-tables:

alpha
beta gamma
delta
epsilon zeta
eta
theta iota

Hout (talk) 15:41, 6 September 2021 (UTC)

where the following (single root / tree):

top level
    alpha
        beta
        gamma
    delta
        epsilon
        zeta
    eta
        theta
        iota

would have rendered as:

top level
alpha delta eta
beta gamma epsilon zeta theta iota

Hout (talk) 15:49, 6 September 2021 (UTC)