Skip to content

Instantly share code, notes, and snippets.

@ryanlecompte
Created March 22, 2013 01:06
Show Gist options
  • Save ryanlecompte/5218189 to your computer and use it in GitHub Desktop.
Save ryanlecompte/5218189 to your computer and use it in GitHub Desktop.
➜ ~ scala
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_41).
Type in expressions to have them evaluated.
Type :help for more information.
scala> object & {
| def unapply[A](a: A): Option[(A, A)] = Some((a, a))
| }
defined module $amp
scala> val (a :: b :: c) & (d :: _) = List(1,2,3)
a: Int = 1
b: Int = 2
c: List[Int] = List(3)
d: Int = 1
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment