在处理一些复杂问题的时候,最常用到的两个方法是递归和叠代,它们直接利用计算机的高速计算能力解决问题。
Recursion and iteration are two very commonly used, powerful methods of solving complex problems, directly harnessing the power of the computer to calculate things very quickly.
此外,递归函数也增强了语言的表达能力。
In addition, recursive functions add significant expressive power to the language.
当然,列表的强大力量部分来自于递归处理列表元素的能力,这表示可以从列表提取头部,直到列表为空,然后累积结果。
Of course, part of the power of lists comes in recursive processing of the list elements, which simply means pulling the head from the list until the list is empty, then accumulating the results.
应用推荐