fork(2) download
  1. import Numeric.Implicits._
  2.  
  3. object Main extends App {
  4. def mapPlusOne[T: Numeric](xs: Seq[T]): Seq[T] =
  5. xs.map(_ + implicitly[Numeric[T]].fromInt(1))
  6.  
  7. println(mapPlusOne(Seq(1, 2, 3, 4, 5)))
  8. }
  9.  
Success #stdin #stdout 0.4s 381952KB
stdin
Standard input is empty
stdout
List(2, 3, 4, 5, 6)