Mutual recursion: Difference between revisions
Content deleted Content added
Not a robot (talk | contribs) Add SETL |
|||
Line 3,842: | Line 3,842: | ||
0 0 1 2 2 3 4 4 5 6 6 7 7 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 |
||
</pre> |
</pre> |
||
=={{header|SETL}}== |
|||
<syntaxhighlight lang="setl">program mutual_recursion; |
|||
print("F", [f(n) : n in [0..14]]); |
|||
print("M", [m(n) : n in [0..14]]); |
|||
proc f(n); |
|||
return {[0,1]}(n) ? n - m(f(n-1)); |
|||
end proc; |
|||
proc m(n); |
|||
return {[0,0]}(n) ? n - f(m(n-1)); |
|||
end proc; |
|||
end program;</syntaxhighlight> |
|||
{{out}} |
|||
<pre>F [1 1 2 2 3 3 4 5 5 6 6 7 8 8 9] |
|||
M [0 0 1 2 2 3 4 4 5 6 6 7 7 8 9]</pre> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |