通过高阶函数,这很容易做到。
高阶函数提供比面向对象概念更高层次的抽象。
Higher-order functions offer a higher level of abstraction than object-oriented concepts.
后续内容还会对闭包与高阶函数做一些有趣的对比。
I'll also circle back to some interesting comparisons between closures and higher-order functions in a later installment.
适合采用高阶函数来解决的问题不仅限于函数式语言中。
The problems amenable to solution by using higher-order functions aren't unique to functional languages.
转换到函数样式的收益之一就是能利用语言或框架提供的高阶函数。
One of the benefits of switching to a functional style is the ability to leverage higher-order function support provided by the language or framework.
lambda函数是用于将高阶函数传入lisp函数的函数定义。
A lambda function is a function definition that you use to pass higher-order functions into Lisp functions. For example, the lambda expression in Listing 10 computes the sum of two integers.
所以,基于动态类型和高阶函数,您可以在任何时候向类中引入任意的行为。
So based on the dynamic typing and higher-order functions, you can introduce arbitrary behavior to your classes at any time.
高阶函数的最常见用法或许是lambda表达式,这是闭包的lisp版。
Perhaps the most common use of higher-order functions is the lambda expression, which is Lisp's version of a closure.
如果使用过高阶函数或闭包,那么可能更容易理解清单10中的代码。
If you've ever used closures or higher-order functions, you might have a better understanding of the code in Listing 10.
函数式编程通过提取通用的功能部分来实现代码重用,可通过高阶函数进行定制。
Functional programming achieves code reuse by abstracting out generic pieces of machinery, customizable via higher-order functions.
通过将使用函数和方法作为高阶函数进行开发,可使应用程序更加健壮。
By developing utility functions and methods as higher-order functions, you make your applications more robust.
将函数用作函数的参数,或将函数作为值返回,这些概念属于高阶函数的领域。
Using a function as a function argument, or returning a function as a value, elevates this abstraction into the realm of higher-order functions.
参数传递给高阶函数,然后作为参数传递给closure的use关键字,仍保持其值。
Arguments passed to higher-order functions, and then passed on as arguments to a closure's use keyword also retain their values.
php的array _ filter是函数式编程语言中高阶函数的一个例子。
PHP's array_filter is an example of what is know in functional programming as a higher-order function.
第8章是本书的核心,它实现了对其他函数进行操作的函数(高阶函数,这可能就是本书得名的由来)。
Chapter 8 is the heart of the book, implementing functions that operate on other functions (higher-order functions, possibly the reason for the title of the book).
由于高阶函数的可用性,确定数字是否完全的整个问题在Groovy中只需几行代码即可完成,如清单7所示。
With the availability of higher-order functions, the entire problem of determining if a number is perfect or not collapses to a couple of lines of code in Groovy, as shown in Listing 7.
这些由列表构建的简单指令构成了递归、高阶函数,甚至是闭包和continuation之类高级抽象的基础。
These simple list-building instructions form the foundation of recursions, higher-order functions, and even higher-order abstractions like closures and continuations.
temperature高阶函数返回current的值,而current又可以有hot或cold函数。
The temperature higher-order function returns the value of current, which has either the hot or cold function.
很多示例代码采用了高阶函数以便利用saxon - sa专有的扩展函数(具体而言即saxon:function )。
Many of the code examples use higher-order functions to take advantage of specific Saxon-SA extension functions (specifically, the Saxon: function ).
在适应了lambdas和closures以后,您可能会发现,通过编写您自己的高阶函数您已经减少了代码并创建了更多的可读与可用代码。
After becoming comfortable with lambdas and closures, you may find yourself reducing code and creating more readable and reusable code by writing your own higher-order functions.
特别地,函数式编程语言必须提供高阶和一流的函数,这是本文所定义的。
Specifically, functional programming languages must provide high-order and first-class functions, which this article defines.
函数语言结构,如高阶和一级函数,能让我对抽象的理解更进一步,让我更多地将精力放在代码能做什么而不是怎么做 上。
Functional language constructs such as higher-order and first-class functions allow me to climb one more rung up the abstraction ladder and focus more on what the code does rather than how it does it.
您会看到,一旦您习惯了从高阶和一级函数的角度思考,您就能减少(一语双关)代码中无用的部分。
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.
本文利用高阶集团展开方法(三阶),求出二元系统配分函数的表达式。
In this paper, by using higher term virial expansion method, we get the expression of partial function for Hardsphere system.
用高阶奇数多项式拟合非线性混合函数,建立非线性信号盲分离模型。
The model of nonlinear blind source separation(NBSS) is built which the nonlinear transfer function is simulate by the P-th order polynomial function.
本文利用母函数和递推关系求解一般高阶等比序列,得到了这类序列的一般解。
In this paper, the general high order equal ratios sequence have been studied by generating functions and recursion relations.
应力张量,作为以单个应变张量为变量的张量值函数,用含有高阶弹性张量的张量多项式来表示。
As a tensor-valued function with a single tensor variable, i. e. strain, stress is expressed as a tensor polynomial that contains high order elasticity tensors.
研究了三个函数乘积的高阶导数,得到了一组相应的导数公式。
This paper studies derivatives of higher order about product of three functions, and obtains a group dependent derivative formulas.
在许多盲信号源分离算法中,大多需要选择合适的非线性函数或者需要计算信号的高阶统计量。
In many algorithms for blind source separation, most of them must select nonlinear function or compute high-order statistical values.
在许多盲信号源分离算法中,大多需要选择合适的非线性函数或者需要计算信号的高阶统计量。
In many algorithms for blind source separation, most of them must select nonlinear function or compute high-order statistical values.
应用推荐