Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Partial application of curried functions using infix #5073

@scabug

Description

@scabug

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions