Talk:Tree from nesting levels: Difference between revisions
m
→Labelled an example of Node as a tuple of a possible integer with a list of Nodes
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.
A consistent recursive data structure
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>
<lang python>(None, [])
|