Mutual recursion: Difference between revisions

Logo
(Forth)
(Logo)
Line 317:
}
}</lang>
 
=={{header|Logo}}==
Like Lisp, symbols in Logo are late-bound so no special syntax is required for forward references.
 
<lang logo>
to m :n
if 0 = :n [output 0]
output :n - f m :n-1
end
to f :n
if 0 = :n [output 1]
output :n - m f :n-1
end
 
show cascade 20 [lput m #-1 ?] []
[1 1 2 2 3 3 4 5 5 6 6 7 8 8 9 9 10 11 11 12]
show cascade 20 [lput f #-1 ?] []
[0 0 1 2 2 3 4 4 5 6 6 7 7 8 9 9 10 11 11 12]
</lang>
 
=={{header|Objective-C}}==
Anonymous user