Mutual recursion: Difference between revisions
Content deleted Content added
Line 1,450: | Line 1,450: | ||
=={{header|EMal}}== |
=={{header|EMal}}== |
||
<syntaxhighlight lang="emal"> |
<syntaxhighlight lang="emal"> |
||
fun F = int |
fun F = <int n|when(n == 0, 1, n - M(F(n - 1))) |
||
fun M = <int n|when(n == 0, 0, n - F(M(n - 1))) |
|||
return n - M(F(n - 1)) |
|||
end |
|||
fun M = int by int n |
|||
if n == 0 do return 0 end |
|||
return n - F(M(n - 1)) |
|||
end |
|||
write("F: ") |
write("F: ") |
||
range(0, 21).list(<int n|write(F(n) + ", ")) |
range(0, 21).list(<int n|write(F(n) + ", ")) |