Skip to content

Instantly share code, notes, and snippets.

@Shinpeim
Created May 27, 2013 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Shinpeim/5655335 to your computer and use it in GitHub Desktop.
Save Shinpeim/5655335 to your computer and use it in GitHub Desktop.
case class Nyan(name:String, age:Int)
val nyans:List[Nyan] = List(Nyan("ねこがた", 2), Nyan("うーねこ", 4))
val has_wneko:List[Nyan] => Unit = l => l match {
case Nil => println("うーねこのっといんざりすとなうよー")
case Nyan("うーねこ", _) :: _ => println("うーねこいんざりすとなうよー")
case _ :: rest => has_wneko(rest)
}
has_wneko(nyans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment