Mutual recursion

From Fōrmulæ wiki
Jump to: navigation, search

This page is the answer to the task Mutual recursion in the Rosetta Code.

Description (from Rosetta Code)

Two functions are said to be mutually recursive if the first calls the second, and in turn the second calls the first.

Write two mutually recursive functions that compute members of the Hofstadter Female and Male sequences defined as:

(If a language does not allow for a solution using mutually recursive functions then state this rather than give a solution by other means).


The same program when the flowchart package visualization is selected. Click/tap to enlarge