List ToString

object ToString {

  def toString(l: List[Double]): List[String] = FoldRight.foldRight(l, Nil: List[String])((a: Double, b: List[String]) => a.toString() :: b)

  def main(args: Array[String]): Unit = {

    println(toString(List(1.010, 2.1, 3.2, 4.3, 5.4)))

  }

}
List(1.01, 2.1, 3.2, 4.3, 5.4)

 

posted on 2016-04-23 08:23  JonkeyGuan  阅读(326)  评论(0编辑  收藏  举报