Content deleted Content added
→Basic examples: type hint |
|||
Line 49:
As a more general class of examples, an algorithm on a tree can be decomposed into its behavior on a value and its behavior on children, and can be split up into two mutually recursive functions, one specifying the behavior on a tree, calling the forest function for the forest of children, and one specifying the behavior on a forest, calling the tree function for the tree in the forest. In Python:
<source lang="python">
</source>
In this case the tree function calls the forest function by single recursion, but the forest function calls the tree function by [[multiple recursion]].
|