I recently played with the scala pattern, and I was wondering if there is a way to create an extractor inside the case statement. The following code works, but first you must define the extractor and assign it to val:
val Extr = "(.*)".r "test" match { case Extr(str) => println(str) }
What I would like to do, or what I would like someone to confirm, is impossible, it is something like this:
"test" match { case ("(.*)".r)(str) => println(str) }
EDIT: If any of the scala team reads this: would it be possible to implement this?
source share