Talk:Tree from nesting levels: Difference between revisions
Content added Content deleted
Line 72: | Line 72: | ||
We can obtain a self-consistent representation of these forests as lists of tuples, in which the first value is a kind of sum type – in Python terms (None or integer), and the second value is itself a (possibly empty) forest. |
We can obtain a self-consistent representation of these forests as lists of tuples, in which the first value is a kind of sum type – in Python terms (None or integer), and the second value is itself a (possibly empty) forest. |
||
A consistent recursive data structure |
A consistent recursive data structure – lets give it a name like '''Node'''. |
||
In Python terms, '''Node''' here is a tuple of a possible integer with a list of '''Nodes''': |
|||
<pre>Node (None|Int) :: ((None|Int), [Node])</pre> |
<pre>Node (None|Int) :: ((None|Int), [Node])</pre> |
||
<lang python>(None, []) |
<lang python>(None, []) |