Scala strange implicit boxing conversion error
问题 Can someone tell me why the following does not work? object TestObject { def map(f: (Double, Double) => Double, x2: Array[Double]) = { val y = x2.zip( x2 ) val z = y.map(f) z } } Produces this error: type mismatch; found : (Double, Double) => Double required: ((Double, Double)) => ? 回答1: In this snippet, f is a function taking two Double parameters and returning a Double . You are attempting to call f by passing a single argument of type Tuple2[Double,Double] . You can fix this by changing