Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
tail recursion

In traditional recursion, the typical model is that recursive calls are performed first, and then take the return value of the recursive call and calculate the result. In this manner, you don't get the result of calculation until you have returned from every recursive call.

In tail recursion, calculations are performed first, and then execute the recursive call, passing the results of current step to the next recursive step. The last statement is formed like"(return (recursive-function params))"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.