ASSIGN_OP 中的模式匹配任何标准的赋值运算符:=、+=、-=、*=,等等,但是注意不要匹配其他包含 = 的运算符,比如 == 和 =~。
The pattern in ASSIGN_OP matches any of the standard assignment operators: =, +=, -=, *=, etc. but carefully avoids matching other operators that contain =, such as == and =~.
例如,可以使用一个模式匹配同时为两个变量赋值(参见清单31)。
For example, we can assign values to two variables simultaneously with one pattern matching (see Listing 31).
为变量赋值实际上就是一种特殊的模式匹配。
Assigning values to variables is actually a special type of pattern matching.
应用推荐