I’ve written the following two functions. Can someone help me understand the error message?
def mapcar[A1,A2,A3,B](f:(A1,A2,A3)=>B, L1:List[A1],L2:List[A2],L3:List[A3]):List[B] = {
(L1,L2,L3).zipped.map(f)
}
def f (a:Int,b:Int,c:Int) = {a+b+c}
The following works properly, returning List(111, 222, 333, 444)
mapcar(f, List(1,2,3,4), List(10,20,30,40), List(100,200,300,400))
However, the following doesn’t work:
mapcar(_+_+_, List(1,2,3,4), List(10,20,30,40), List(100,200,300,400))
giving the following error message
<console>:15: error: missing parameter type for expanded function ((x$1: <error>, x$2, x$3) => x$1.$plus(x$2).$plus(x$3))
mapcar(_+_+_, List(1,2,3,4), List(10,20,30,40), List(100,200,300,400))