スカラで thisコードを再作成しようとしています。スカラーの2d Charリストのマッピング
/*
This is a program for the #259 [Easy] Clarence the Slow Typist /r/dailyprogrammer challenge
The algorithm was created by /u/derision.
*/
object Clarence {
def main(args: Array[String]) {
val ip = args(0)
println(ip.tail.zip(ip).map(_.map(x => "123456789.0".indexOf(x))))
}
}
これは2次元配列を生成しなければならないが、私はそれを実行したときに、私は次のエラーが出る::私が言うことができるものから、
scala Clarence.scala 219.45.143.143
/home/mattjone/sw/coding/learning-scala/Clarence.scala:8: error: value productElements is not a member of (Char, Char)
println(ip.tail.zip(ip).map(_.map(x => "123456789.0".indexOf(x))))
^
one error found
が、それはあなたができることを言っているこれは、私がこれまで持っているものです文字の配列に.mapを使用していないが、それは意味をなさない。私はこれをどのようにしなければならないのですか?