// tupels def divmod(x: Int, y: Int): (Int, Int) = (x / y, x % y) // ( 1 ,2) is syntactic sugar for Tuple2[Int,Int]( 1 ,2) /* try divmod(x, y) match { case (n, d) => println("quotient: " + n + ", rest: " + d) } */ // functions are objects as well, again with some syntactic sugar // class for single-rgument functions trait Function1[-A, +B] { def apply(x: A): B } val plus1: (Int => Int) = (x: Int) => x + 1 plus1(2) // is a shortHand for val plus1: Function1[Int, Int] = new Function1[Int, Int] { def apply(x: Int): Int = x + 1 } plus1.apply(2)