Are scala case patterns first class?

Viewed 282

Is it possible to pass case patterns as parameters to other functions? Something like this:

def foo(pattern: someMagicType) {
  x match {
    pattern => println("match")
  }
}

def bar() {
  foo(case List(a, b, c))
}
3 Answers
Related