Created
December 12, 2016 10:05
-
-
Save lrytz/e10b166ffbed2e47348a7ef8cd072fd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class C(x: Int) | |
case class D(i: Int*, | |
) | |
object Test extends App { | |
C(1) match { | |
case C(x @ 1, | |
) => println(x) | |
case _ => println(0) | |
} | |
def f(x: Int, y: Int*) = y.foldLeft(x)(_+_) | |
println(f(1,2, | |
)) | |
println(f(1,List(2, 3): _*)) | |
println(f(1,List(2, 3): _*, | |
)) | |
import scala.collection.{mutable, immutable, | |
} | |
println(mutable.Map(1 -> "one")) | |
D(1,2,3) match { | |
case D(1, 2, _ @ _*, | |
) => println(1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment