
上QQ阅读APP看书,第一时间看更新
Recursion and trampolining
There is a special case of a function calling another function—the function calling itself. Such functions are called recursive. Recursive functions can be head-recursive or tail-recursive. There is also an approach to model recursive calls in an object-oriented way called trampolining. Recursion is very convenient and often uses the technique in functional programming, so let's take a close look at these concepts.