You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We get a compiler error when trying to partially apply a /: (left fold)
def f(xs: List[Int]) = (0 /: xs) _
:15: error: missing arguments for method /: in trait TraversableOnce;
follow this method with `_' if you want to treat it as a partially applied function
@paulp said:
This is essentially a duplicate of #1980 because they're both caused by the odd desugaring performed on right associative operations. Maybe I can get both.
We get a compiler error when trying to partially apply a /: (left fold)
def f(xs: List[Int]) = (0 /: xs) _
: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.foldLeft(0) _
def f(xs: List[Int]) = xs./:(0) _
def f(xs: List[Int]): ((Int, Int) => Int) => Int = (0 /: xs)
http://stackoverflow.com/q/7735736/770361
The text was updated successfully, but these errors were encountered: