Finally, for the case of recursive expressions, the parser should simply echo parentheses when it sees them within the expression recursion, as illustrated in Listing 21.
最后对于递归表达式的情况,当解析器在表达式递归中看到括号时,就应该简单地进行回送,如清单21中所示。
The Listing 8 code uses a pair of mutually recursive methods for the actual analysis.
清单8 中的代码使用两个相互递推的方法进行实际的分析。
The classes in Listing 2 show how this recursive loading works.
清单2中的类显示了这一递归装入的工作方式。
To test this preliminary logging code, I'll use a nicely recursive method, an implementation of the Fibonacci sequence calculation, as shown in Listing 4.
为了测试这段初步的日志记录代码,我将使用一个精巧的递归方法,它是斐波纳契数列计算的一个实现,如清单 4 所示。
The steps required to write such a recursive function are listed below, and Listing 3 presents the source code of the function itself.
编写这种递归函数需要执行的步骤如下所示,清单3给出了这个函数的源代码。
Listing 2's implementation runs in o (n) time. I won't prove this, but the running time of Listing 1's naive, recursive implementation is exponential in n.
清单2中的实现所需的时间比清单1短许多,清单2的运行时间为O (n),而清单1中的递归实现的运行时间是n的指数。
But Listing 1's code is inefficient because it solves some of the same recursive subproblems repeatedly. For example, consider the computation of fibonacci1 (5), represented in Figure 1.
但是清单1的代码效率不高,因为它重复地解决相同的递归子问题。
Now I'll use those methods to build a recursive processor to interpret generics. Listing 8 gives the code for this purpose
现在我将用这些方法构建一个解释泛型的递推处理程序。
The rest of Listing 2 should seem familiar, at least in approach. The function reveal is recursive.
清单2的其余部分应该比较熟悉,至少对于方法是这样。
This functionality works well as a recursive application, as shown in the sample factorial function in Listing 4.
这个功能作为递归应用程序工作良好,如清单4中的样本阶乘函数所示。
Finally, for the case of recursive expressions, the parser should simply echo parentheses when it sees them within the expression recursion , as illustrated in Listing 21.
最后对于递归表达式的情况,当解析器在表达式递归中看到括号时,就应该简单地进行回送,如清单21中所示。
Finally, for the case of recursive expressions, the parser should simply echo parentheses when it sees them within the expression recursion , as illustrated in Listing 21.
最后对于递归表达式的情况,当解析器在表达式递归中看到括号时,就应该简单地进行回送,如清单21中所示。
应用推荐