The answer lies in recursive functions.
答案是递归函数。
This allows for anonymous recursive functions.
这将允许匿名递归函数。
Let's look at a few examples of recursive functions on linked lists.
让我们来看一些基于链表的递归函数示例。
In fact, loops and recursive functions can be considered interchangeable.
实际上,可以认为循环和递归函数是能够相互转换的。
But walking a tree just by using recursive functions is not all that difficult.
但是只用递归函数来遍历树并不十分困难。
In addition, recursive functions add significant expressive power to the language.
此外,递归函数也增强了语言的表达能力。
The resulting stylesheets have many recursive functions and are difficult to debug.
得到的样式表有太多递归函数,难以调试。
Explains the concept of recursion and illustrates how to write recursive functions.
解释递归的概念,并阐释如何编写递归函数。
Traditional Gene Expression Programming (GEP) is bare of discovering recursive functions.
传统基因表达式编程(GEP)无法发现递归函数。
Primitive recursive functions are a naturally defined subclass of the recursive functions.
递归原语函数是递归函数定义的一个子类。
However, one concern people have with the use of recursive functions is the growth of stack space.
不过,对于递归函数的使用,人们所关心的一个问题是栈空间的增长。
You can develop recursive functions to handle entries, objects within entries, authors, and so on.
您可以开发递归函数来处理项、项中的对象、作者等等。
I thought it might be good as an example of MS SAX, recursive functions and subroutines and more.
我想它可作为一个很好的MSSAX,递归函数和子程序等等的示例。
Another model, recursive functions, USES functions and function composition to operate on Numbers.
另一种模式,是递归函数,利用函数和函数复合去操作数值。
Take a look at the properties of loops and see how they compare with those of recursive functions in Table 1.
在表1中了解循环的特性,看它们可以如何与递归函数的特性相对比。
This is how recursive functions keep from trashing the values of the variables in other, active function calls.
这就是递归函数是如何保证其他活动函数调用中的变量值不受影响的。
The named let cuts down considerably on the amount of typing and mistakes made when writing recursive functions.
在编写递归函数时,命名let能够相当程度地减少键盘输入以及出现错误的数量。
Functions can also be nested within each other, and you can create recursive functions that call themselves.
函数同样可以相互嵌套调用自身,例如,递归函数。
Recursive functions can sometimes be very resource hungry and may not return results before a user loses patience.
递归函数有时对资源的消耗量很大,而且在用户失去耐心之前可能还没有返回结果。
You'll see later (in Writing functions) how these functions form the backbone of many recursive functions in Haskell.
稍后还会看到(在编写函数中)这些函数如何构成了Haskell中众多递归函数的基础。
In Erlang there is no need for loops because tail recursive functions are transparently optimized to run in constant space.
而在Erlang中不需要使用循环,因为尾递归函数会被自动优化在固定的空间中运行。
If we could find a way to remove these unneeded stack frames, our tail-recursive functions would run in a constant stack size.
如果我们能找到一个除去这些不需要的栈结构的方法,那么我们的尾部递归函数就可以在固定大小的栈中运行。
Since a NULL pointer terminates a list, we can also use the NULL pointer condition as a base case for many of our recursive functions on linked lists.
由于NULL指针会结束一个链表,所以我们也可以使用 NULL 指针条件作为基于链表的很多递归程序的基线条件。
The difference is that with recursive functions, you rarely have to modify any variable — you just pass the new values as parameters to the next function call.
区别在于,使用递归函数极少被迫修改任何一个变量——只需要将新值作为参数传递给下一次函数调用。
The best way to see why stacks are needed is to look at recursive functions. For simplicity, let's look at the recursive implementation of the factorial function.
了解为什么需要堆栈的最好方法是查看递归函数的情况。
It is important to know that functions are not always inlined even if they are declared as such; for example, virtual and recursive functions are not normally inlined.
知道哪些函数即使你声明了内联也不会内联很重要:比如说虚函数和递归函数在一般情况下不会内联。
Just note that writing deeply recursive functions on the SPE is problematic because there is no stack overflow protection on the SPE, and the local store is small to begin with.
请注意在SPE上编写深度递归函数有些问题,原因是在SPE上没有任何堆栈溢出保护,而且本地存储也很小。
Chapter 5 deals with partitioning problems, converting recursive functions to iterative functions (it's fun, I assure you), and more factorial and Fibonacci series implementations.
第 5章介绍了划分问题、递归函数到迭代函数的转换(我可以向您保证,这非常有趣)以及阶乘和斐波纳级数的实现。
For example, the ability to define multiple approaches to the same functions and employ pattern matching for recursive calls simplifies some functions.
例如,可以为同一函数定义多种处理方式,还可以对递归调用应用模式匹配,这样做可以简化某些函数。
The classic Haskell functions that you'll find in most tutorials are recursive math functions, such as Fibonacci functions and factorials.
在大多数教程中可以发现的大多数经典Haskell函数都是递归的数学函数,例如fibonacci函数和阶乘。
应用推荐