选择的名称应当能很好地提示函数的功能。
The name you choose should provide a good hint about what the function does.
递归实际上是定义一个调用自身的函数的方式。
Recursion is actually a way of defining functions in which the function is applied inside its own definition.
略加思索,我修改了这个函数的实现。
该函数的功能正如您所想:它测试一个数是否是偶数。
This function does just what you would think: It tests if a number is even.
这就是纯函数的一个例子,在后续部分会对此做详细介绍。
This is an example of a pure function, a concept I'll investigate further in a future installment.
这意味着函数可以是其他函数的参数,也可以创建和返回其他函数。
This means that functions can be parameters to other functions and can also create and return other functions.
函数注释会在编译时将表述与函数的某些部分(比如参数)相关联。
Function annotations associate expressions with parts of a function, such as parameters, at compile time.
而另一方面,数据库开发人员则可以把精力集中于存储过程与函数的开发。
The database developers, on the other hand, can concentrate on developing stored procedures and functions.
调用自身的函数就是递归的;执行这种函数的过程就叫递归运算。
A function that calls itself is recursive; the process of executing it is called recursion.
在开始深入探讨一些例子之前,不妨回过头来看看传递给这些效果函数的参数。
Before looking at some examples, let's take a step back and talk about the arguments you can pass into these Effects functions.
编程模型是优雅的,基于构造函数的风格意味着您无需包括无参构造函数。
The programming model is elegant, and the constructor-based style means you don't have to include a constructor without arguments.
将函数用作函数的参数,或将函数作为值返回,这些概念属于高阶函数的领域。
Using a function as a function argument, or returning a function as a value, elevates this abstraction into the realm of higher-order functions.
不过,更重要的是该函数的缓存访问量只有原来的三分之一,并且代码更加简洁,更加易于维护。
Far more importantly, however, the function does only one-third as many buffer accesses, and the code is much clearer and more maintainable.
您会看到,一旦您习惯了从高阶和一级函数的角度思考,您就能减少(一语双关)代码中无用的部分。
You can see that once you become accustomed to thinking in terms of higher-order and first-class functions, you can reduce (pun intended) a lot of noise in your code.
闭包功能非常强大,原因是它们使内部函数在外部函数返回时也仍然可以保留对此外部函数的变量的访问。
Closures are powerful because they enable inner functions to retain access to an outer function's variables even after the outer function has returned.
隐式类型系统一个较大的优点是,不需要为函数的参数声明类型,因为编译器会从传入的值推断出参数的类型。
One big advantage of type-inferred systems is that you don't need to declare the types of arguments to a function because the compiler infers them from the parameters you pass in.
教我三角函数的瓦尔纳老师——我本该只因为他教的科目而讨厌他——是唯一一个让我站在全班面前做自我介绍的人。
My Trigonometry teacher, Mr. Varner, who I would have hated anyway just because of the subject he taught, was the only one who made me stand in front of the class and introduce myself.
这就是所谓的驼峰式大小写风格(camelcasing),是Python和其他编程语言中广泛采用的一种技术,可使函数的名称更易阅读。
This approach is known as camel casing and is a popular technique used in Python (and other languages) to make it easier to read the names of functions.
在过去的几年中,人们对函数式编程语言的兴趣高涨。
In the past couple of years, interest in functional programming has skyrocketed.
你顺带还会学到一星半点函数式编程的知识。
You may also learn a thing or two about functional programming.
把闭包应用于函数模式是令人兴奋的,一旦这么做了之后,再把它们应用于面向对象设计模式,就不是什么大事情了。
Applying closures to functional patterns is exciting, and once you've done that, it's not too big a stretch to apply them to object-oriented design patterns.
这反过来揭示了函数式语言的根本性转变:关注结果,而不是步骤。
This in turn exposes a fundamental shift in thinking in functional languages: Focus on results, not steps.
在下一期文章中,我将深入介绍函数编程中的重要概念:不可变性。
In the next installment, I'll talk in depth about one of functional programming's building blocks: immutability.
R既是一门强大的函数式程序设计语言,也是一个用来对数据集进行统计探索的通用环境。
R is both a strongly functional programming language and a general environment for statistical exploration of data sets.
简单地说,方法是在类中声明的函数。
此外,递归函数也增强了语言的表达能力。
In addition, recursive functions add significant expressive power to the language.
您只用了短短几分钟就创建了一个可重用的函数,允许在数据库中存储联系人信息。
In just a few minutes, you've created a reusable function that lets you store contact information in the database.
作为练习,您可以对代码进行重构以将数据访问函数分离到单独的文件中。
You can refactor the code to isolate the data access functions into a separate file as homework.
如果配合方法链接(method chaining)一起使用,这些函数可以使复杂的操作看上去非常简单。
When used together with method chaining, these functions allow complex operations to look simple.
在编写php时,这个函数是一个简单但很有帮助的调试工具。
This function is a rudimentary, yet helpful, debugging tool when working with PHP.
应用推荐