Description Usage Arguments Value Examples
Wrap a return value in your recursive function with trm_return()
to have it passed along and returned by your final recursion.
1 | trm_return(x)
|
x |
A value to be returned at the end of all recursions |
x
with added class attribute 'trampoline_return'
1 2 3 4 5 6 7 8 | trampoline(factorial(13),
factorial = function(n) {
if(n <= 1) {
return(trm_return(1))
}
val <- yield(factorial(n - 1))
return(val * n)
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.