In other words, is there a good reason why this shouldn’t compile?
def f(xs: List[Int]) = xs.foldLeft(0) _ // OK
def f(xs: List[Int]) = (xs :\ 0) _ // OK
def f(xs: List[Int]) = (0 /: xs) _
<console>:15: error: missing arguments for method /: in trait TraversableOnce;
follow this method with `_' if you want to treat it as a partially applied function
Here are some workarounds:
def f(xs: List[Int]) = xs./:(0) _
def f(xs: List[Int]): ((Int, Int) => Int) => Int = (0 /: xs)
but my question is mainly about the proper syntax in general.
I fixed this just now, but I can’t check it in yet because it requires amending the specification.
The problem is that the spec defines “e1 op e2” if op is right-associative to be { val x=e1; e2.op(x ) } for reasons which are not apparent to me, since the simpler e2.op(e1) solves this issue among others, like https://issues.scala-lang.org/browse/SI-1980. I will make inquiries.