author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Tue, 05 Mar 2013 15:23:10 +0000 | |
changeset 213 | 30d81499766b |
parent 193 | 317a2532c567 |
child 221 | 18905d086cbb |
permissions | -rw-r--r-- |
package object lib { //some list functions def tl[A](xs: List[A]) : List[A] = xs match { case Nil => Nil case x::xs => xs } def hd[A](xs: List[A]) : A = xs.head def nth_of[A](xs: List[A], n: Int) = if (n <= xs.length) Some(xs(n)) else None //some map functions def dget(m: Map[Int, Int], n: Int) = m.getOrElse(n, 0) //some string functions def join[A](xs: List[A]) = xs.foldLeft("")(_.toString + _) }