如果碰巧该闭包函数跟某个事件绑定,那么就必须要解绑定。
If you happened to attach the closure to an event, then you would have to detach it from that event.
从外部环境中导入的变量是在闭包函数定义的use子句中指定的。
Variables to be imported from the outside environment are specified in the use clause of the closure function definition.
闭包函数和lambda函数绝对不是新出现的概念;它们均来自函数编程领域。
The concepts of closures and lambda functions are definitely not new ones; they both come from the functional programming world.
默认情况下,它们是由值传递的,意味着如果要更新传递到闭包函数定义内的值,则不更新外部值。
By default, they are passed by value, meaning that if we would update the value passed within the closure function definition, it would not update the outside value.
这个文本搜索包和它的相关函数被称为文本搜索引擎,它是专门设计用来执行文本数据的快速检索和自动索引。
This text search package and its associated functions, referred to as the text search engine, is specifically designed to perform fast retrieval and automatic indexing of text data.
方法或函数可通过传入参数与闭包通信。
A method or function can communicate with a closure by passing in arguments.
可以从包的外部使用该函数。
新的搜索函数包(or g . apache . lucene . search . function)允许开发人员在计算文档相关度使用某个字段的实际内容。
The new search function package (org.apache.lucene.search.function) allows developers to use the actual content of a field in scoring a document.
因此出现了闭包并使lambda函数得到增强。
This is where closures step in and take the lambda functions to the next level.
比如可以在CLPPlus 中无缝地执行创建和删除包、过程、函数、触发器等的语句。
Statements like create and drop package, procedure, function, trigger, etc. can be executed seamlessly in CLPPlus.
在以后的版本中,我将可能会把这个函数移到Gnosis包内的其他地方。
I will probably move the function elsewhere within the Gnosis package for later releases.
在Oracle10g 中可以使用包对过程或函数进行分组。
Packages can be used in Oracle 10g to group a set of procedures or functions.
要构建一个使用闭包的函数,只需要使用yield关键字来调用该闭包。
To build a function that USES a closure, you simply use the yield keyword to invoke the closure.
闭包类似于lambda函数,但是在与定义闭包的外部环境中的变量进行交互方面更加智能。
Closures are like lambda functions, but smarter in the sense that they have the ability to interact with variables from the outside environment of where the closure is defined.
首先,创建在资源包中查找fieldName的el函数。
First, you create an el function that looks up a fieldName in the resource bundle.
函数包是 sample_package。
第二个参数是一个函数闭包。
这个闭合的作用域是将闭包同调用函数和定义它的代码联系起来的纽带。
This closed scope is the communication that ties the closure to the calling function and the code that defines it.
闭包是函数语言的共有特征之一。
Closures are one of the common features of functional languages.
注释是可以添加到代码中的修饰符,可以用于包声明、类型声明、构造函数、方法、字段、参数和变量。
Annotations are modifiers you can add to your code and apply to package declarations, type declarations, constructors, methods, fields, parameters, and variables.
如果没有指定,函数将在定义它的闭包中运行。
A function will run in the closure that defines it unless otherwise specified.
把闭包应用于函数模式是令人兴奋的,一旦这么做了之后,再把它们应用于面向对象设计模式,就不是什么大事情了。
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.
清单3包含有这个函数,它尝试打开数据库(如果尚未打开的话)并查询数据库。
Listing 3 contains this function, which attempts to open the database (if not already opened) and query the database.
我们也可以拥有直接返回闭包的函数,如清单6 所示。
We can also have functions that directly return closures, as we see in Listing 6.
要了解闭包,首先需要了解匿名函数。
To understand closures, one first has to understand anonymous functions.
好奇的读者会想是什么使仿函数不同于匿名函数或闭包呢?
Curious readers will be wondering what makes a functor different from an anonymous function or closure.
闭包是具有闭合作用域的匿名函数。
方法有两种:创建一个工具包来封装所有本机函数;或者将本机函数直接包含到应用程序中。
This could be done in one of two ways. You could either create a toolkit that encapsulates all the native functions, or directly include native functions into an application.
以上演示了为什么闭包体现了函数思想:让运行时管理状态。
This illustrates why the use of closures exemplifies functional thinking: allow the runtime to manage state.
在本文中,我将继续讨论这些概念,讲解一级函数、优化和闭包。
In this article, I'll continue this tour of concepts by talking about first-class functions, optimizations, and closures.
应用推荐