Skip to content

Instantly share code, notes, and snippets.

@ryangreenberg
Created May 2, 2016 16:04
Show Gist options
  • Save ryangreenberg/cab6c0fdf5272f40c57ff52fa503122f to your computer and use it in GitHub Desktop.
Save ryangreenberg/cab6c0fdf5272f40c57ff52fa503122f to your computer and use it in GitHub Desktop.
Scala wat
val s: Seq[Int] = Seq(1,2,3)
val a: Seq[Int] = Array(1,2,3)
def pp(xs: Seq[Int]) = xs match {
case 1 :: 2 :: 3 :: Nil => "we got a match, baby"
case _ => "who knows"
}
pp(s) // "we got a match, baby"
pp(a) // "who knows"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment