How to pattern-match a generic type argument?
如何匹配的泛型类型参数?
A British astronomer was analyzing a spectrograph of sunlight, and he noticed a particular pattern of spectral lines that didn't match anything in the library.
一位英国天文学家在分析一台太阳光摄谱仪时,注意到一种特殊的光谱线模式,它与图书馆里的任何一种都不匹配。
You can precede it with a line number, range, pattern to match, or enclosed in slashes.
您可以在它前面附加行号、范围、要匹配或包括在斜杠中的模式。
It is surprisingly simple: the name itself differs, so we can use a simple pattern match on the name field.
令人惊奇的简单:只是名字上的区别,所以我们可在NAME域上使用一个简单的模式匹配。
To find these concepts in text, you can specify rules that define a pattern to match these concepts.
为了在文本中寻找这些概念,可以通过指定规则定义匹配这些概念的模式。
Let's try a deep match, examining the contents of objects in our pattern match.
让我们来尝试一次深度匹配,在我们的模式匹配中检查对象的内容。
This function literal does a pattern match on the message instance to decide how to handle the message.
这个字面函数给消息做了一个模式匹配来决定它被如何处理。
Note in the evaluation, if the pattern is a bound variable, or the element of the pattern is a bound variable, then the result of the pattern match becomes a comparison.
注意,如果模式是绑定的变量,或者模式的元素是绑定的变量,那么模式匹配的结果就会变成比较。
Recall that the cases in a pattern match are evaluated in order.
回忆一下,模式匹配的cases会被按顺序依次被评估。
If a pattern match is found, the connection is let in, or more precisely, TCPD dies and lets the real serving daemon take over.
如果找到匹配的模式,就允许连接,或者更准确地说,tcpd死亡,让真正提供服务的守护进程接管。
Note that evaluate returns a Double, which means that each case in the pattern match is going to have to evaluate into a Double value.
注意evaluate返回了一个Double,它意味着模式匹配中的每一个case都必须被求值成一个double值。
Thankfully, Scala treats exception handling as just another pattern match, allowing us to make smart choices when presented with a multiplicity of potential exceptions. Let's see this in action.
感谢scala实际上把异常处理作为了另外一种模式匹配,允许我们在遇到多样化的异常时能做出更聪明的决定。
This type of pattern match becomes extremely useful when working with Actors, as we'll see later on.
我们后面会看到,这种类型的模式匹配和Actor配合工作时会非常有用。
This pattern will match a UserList element with any kind of children.
这个模式将会和一个具有任意类型的子节点的UserList元素匹配。
If the pattern does not match the version string pattern, a status message is created.
如果模式与版本字符串模式不相匹配,那么就会创建一条状态信息。
The hosts.deny is then searched for a pattern match.
然后在 hosts.deny 中搜索匹配的模式。
Our pattern match then looks for Alice and Bob by inspecting the values passed to the constructor of the Person case class.
然后,我们的模式匹配通过检查传入的Personcase类的值来查找Alice和Bob。
Since we are now using SQL SELECT statements, the restore_where argument changes from a Perl pattern match to the syntax of an SQL where clause.
因为现在使用的是SQLselect语句,所以restore_where自变量从Perl模式匹配改成SQL where子句。
The topic exchange also takes the routing-key property of the message into account by performing a pattern match on it.
topic交换器用过模式匹配分析消息的routing-key属性。
Using the Filter Pushdown pattern, we would first match a pattern in the graph, then modify the tree at the point of the match. Here's the Filter Pushdown pattern to match.
我们将首先利用FilterPushdown模式来匹配图中的某个模式,随后在匹配的点对树进行修改。
You might also want to change the names of various generic aspects of the pattern to match the language of the domain.
您还可能会希望更改模式的通用方面的名称,以与域的相应语言对应。
This keyword is followed by a graph pattern to match against the graph in question.
这个关键字后面是要与图匹配的图形模式。
You may include a "default" case at the end of a pattern match, either using the underscore wild card character or a meaningfully-named variable.
你可以在模式匹配的最后包含一个“default”默认case,可以使用下划线通配符,或者有含义的变量名。
Include [pattern] — include only files that match the given pattern.
include[模式]——只包含与指定模式匹配的文件。
So as well as being able to pattern match over values, such as integers, floating point Numbers and strings, we are also able to pattern match over an objects type.
所以正如能够匹配很多值一样,我们也能够匹配很多对象类型,如:整数、浮点数和字符串。
With a pattern match, there's little chance of making that specific mistake, although there's still plenty of other things to screw up.
模式匹配,犯了特定错误的可能性很小,虽然还有很多其他事情要搞砸了。
A programming language which is designed for string manipulation and pattern match comparison.
为串处理和模式匹配比较而设计的一种编程语言。
The model introduced state shift concept and inosculated pattern match detection and state shift detection, which overcame the shortcoming that other models detected only using single character.
模型引入了状态转移概念并将模式匹配检测和状态转移检测结合在一起,克服了已有模型只专注于单一特征检测的缺陷。
This paper describes a model of English lexical selection, based on example comparison and with the help of semantic pattern match.
本文描述了一种基于实例比较,辅以语义模式匹配的英文选词模型的设计。
We also improved pattern match algorithm, so the network detection engine can perform more quickly.
同时改进了模式匹配算法,使得网络检测引擎具有更好的实时性能。
应用推荐