编辑代码

object Hello extends App {
    def map(arr:Array[Int],op:Int=>Int)={
        for (elem<-arr)yield op(elem)
    }
    val arr=map(Array(1,170),(x:Int)=>{x*2})
    println(arr.mkString(","))
    val arr1=map(Array(6,160),(x:Int)=>{x*2})
    println(arr1.mkString(","))
}