当函数在尾部调用中调用自己时,方法更为简单。
When a function calls itself in a tail-call, the method is even easier.
在尾部调用之后除去栈结构的方法称为 尾部调用优化。
The idea of removing stack frames after tail-calls is called tail-call optimization.
可见,尾部调用使用了更多一些指令,但是它们可以节省相当多内存。
As you can see, tail-calls take a few more instructions, but they can save quite a bit of memory. There are a few restrictions for using them.
Let's go the other direction. And yes, I guess I'd better say s not 2, or we're going to get an error here. Again, in twenty-three checks.
这里我得说不能是2,否则要报错了,再一次,调用了23次,在这个例子里,它从尾部开始。
应用推荐