而在Erlang中不需要使用循环,因为尾递归函数会被自动优化在固定的空间中运行。
In Erlang there is no need for loops because tail recursive functions are transparently optimized to run in constant space.
另外一项差异在于,在zippers版本内部使用的是数据结构的线性尾递归遍历,而非递归遍历。
Another difference is that, internally, the zipper version USES a linear tail-recursive traversal of the data structure instead of a recursive traversal.
这个例子使用 Scheme 中所谓的尾递归(tail recursion)。
应用推荐