Mutual recursion
A direct translation of the definitions of F {\displaystyle F} and M {\displaystyle M}
:
multi F(0) { 1 }; multi M(0) { 0 }
multi F(\๐) { ๐ - M(F(๐ - 1)) }
multi M(\๐) { ๐ - F(M(๐ - 1)) }
say map &F, ^20;
say map &M, ^20;
Output:
1 1 2 2 3 3 4 5 5 6 6 7 8 8 9 9 10 11 11 12
0 0 1 2 2 3 4 4 5 6 6 7 7 8 9 9 10 11 11 12
Last updated
Was this helpful?