2011-08-20から1日間の記事一覧
Some codes to understand lists and recursions from practical scala def nth[T](n: Int, list: List[T]): T = list match { case x::_ if n == 0 => x case x::xs => nth(n-1, xs) case _ => sys.error("illegal argument") } //println(nth(2, List(1,2,…