在scala中如果一个函数在最后一步调用自己(必须完全调用自己,不能加其他额外运算子),那么在scala中会复用函数栈,这样递归调用就转化成了线性的调用,效率大大的提高.If a function calls itself as its last action, the function's stack frame can be reused. This is called tail recursion.=> Tail recursive functions are iterative proc…