现在,让我们回到阶乘函数上来。
这极大地限制了阶乘函数的可能范围。
This limits greatly the possible range of your factorial function.
这个功能作为递归应用程序工作良好,如清单4中的样本阶乘函数所示。
This functionality works well as a recursive application, as shown in the sample factorial function in Listing 4.
复杂算法通常比较容易使用递归实现。事实上,有些传统算法正是以递归实现的,诸如阶乘函数。
Complex algorithms are typically made easier by using recursion. In fact, there are some traditional algorithms that presume recursion as the implementation, such as a function to return factorials.
这段代码看起来比较多,但您也无需望而却步,因为其中大部分都是注释和声明(阶乘函数本身只有16个指令)。
Don't be taken aback by the size of the code — it's mostly comments and declarations (the factorial function itself only has 16 instructions).
这个程序的运行流程和5.8里面的那个倒计时有点相似。我们用3作为参数来调用一下这个阶乘函数试试。
The flow of execution for this program is similar to the flow of countdown in Section 5.8. If we call factorial with the value 3.
它的功能还包含计算三角函数,阶乘,排列和组合的计算。
Some of the features include trigonometry, factorials, permutations and combinations.
第 5章介绍了划分问题、递归函数到迭代函数的转换(我可以向您保证,这非常有趣)以及阶乘和斐波纳级数的实现。
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.
在大多数教程中可以发现的大多数经典Haskell函数都是递归的数学函数,例如fibonacci函数和阶乘。
The classic Haskell functions that you'll find in most tutorials are recursive math functions, such as Fibonacci functions and factorials.
科学计算,加、减、乘、除、开方、平方、三次方、三角函数(sincos tan)、阶乘、求反、取模等。
Scientific calculator supporting addition, subtraction, multiplication, division, square-root, square, cube, sin, cos, tan, Factorial, inverse, modulus.
写出一个用递归来计算阶乘的函数。
Write a function that calculates a number's factorial using recursion.
否则,使用递归函数计算阶乘。
Otherwise, a recursive function is used to calculate the factorial.
依照伽马函数,对通常的阶乘、排列、组合的概念进行了推广,并证明了一些常用的组合公式。
Using gamma function, the paper popularized the common conceptions of the usual factorial, permutation and combination and proved some combination formulas in common use.
依照伽马函数,对通常的阶乘、排列、组合的概念进行了推广,并证明了一些常用的组合公式。
Using gamma function, the paper popularized the common conceptions of the usual factorial, permutation and combination and proved some combination formulas in common use.
应用推荐