Difference between revisions of "Mutual recursion"

From Fōrmulæ wiki
Jump to: navigation, search
(Creation of page)
 
m
Line 21: Line 21:
 
=== Solution ===
 
=== Solution ===
  
[[File:MutualRecursionFlowchart.png|thumb|link=http://dictionary.formulae.org/mediawiki/images/5/54/AnonymousRecursionProgramFlowchart.png|The same program when the flowchart package visualization is selected. Click/tap to enlarge]]
+
[[File:MutualRecursionFlowchart.png|thumb|link=http://dictionary.formulae.org/mediawiki/images/4/46/MutualRecursionFlowchart.png|The same program when the flowchart package visualization is selected. Click/tap to enlarge]]
  
 
[[File:MutualRecursionProgramCode.png|border]]
 
[[File:MutualRecursionProgramCode.png|border]]

Revision as of 20:01, 1 October 2018

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).

Solution

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

MutualRecursionProgramCode.png

Example

MutualRecursionOutput1.png