2
爲什麼是它(在斯卡拉REPL)我可以寫,例如,斯卡拉地圖使用「_」
def double(d: Int) = 2*d
(0 until 10).zipWithIndex.map(i => double(i._1))
或只是
(0 until 10).zipWithIndex.map(_._1)
但我不能寫
(0 until 10).zipWithIndex.map(double(_._1))
error: missing parameter type for expanded function ((x$1) => x$1._1) (0 until 10).zipWithIndex.map(double(_._1))
?
可能的重複:http://stackoverflow.com/questions/2173373/scala-foreach-strange-behaviour – sschaef