The N- tuple pattern recognition approach is an adaptive one easy to implement in parallel with hardware.
元模式识别方法是一种易于硬件并行实现的自适应模式识别方法。
The following example shows how to loop over a sequence, and how to use a tuple pattern instead of a simple variable.
下面的示例演示如何循环一个序列,以及如何使用元组模式来代替简单变量。
Finally, we can use pattern matching to pull out the elements from a list or tuple using the construct notation mentioned earlier.
最后,可以按前面提到的构造表示方法,使用模式匹配从列表或元组中提取元素。
For example, to get the name and email from a tuple, we can use pattern matching: {contact, Name, Email} = {contact, "Me", "me@example.com"}.
例如,为了从元组中获取姓名和电子邮件地址,可以使用以下模式匹配:{contact,Name,Email} = {contact, "Me", "me@example.com"}。
The two sides of the operation must match (that is, if you have 2 element tuple as the pattern, the expression must resolve to a 2 element tuple).
操作的两边必须匹配(也就是说,如果模式是包含两个元素的元组,那么表达式的计算结果也必须是包含两个元素的元组)。
Pattern matching is used to evaluate the arguments to the function, so if you supply a tuple with three elements to the mathexp() function, the pattern matching will fail.
使用模式匹配评估函数的参数,所以如果把包含三个元素的元组提供给mathexp() 函数,模式匹配会失败。
Pattern matching is used to evaluate the arguments to the function, so if you supply a tuple with three elements to the mathexp() function, the pattern matching will fail.
使用模式匹配评估函数的参数,所以如果把包含三个元素的元组提供给mathexp() 函数,模式匹配会失败。
应用推荐