【发布时间】:2012-08-16 11:54:37
【问题描述】:
是否可以将 case 模式作为参数传递给其他函数?像这样的:
def foo(pattern: someMagicType) {
x match {
pattern => println("match")
}
}
def bar() {
foo(case List(a, b, c))
}
【问题讨论】:
-
在您更改问题之前,我使用了 Scala 2.10 的
Try。也许你仍然觉得这很有用:stackoverflow.com/questions/11990017/…
标签: scala pattern-matching first-class