Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial application of curried functions using infix #5073

Open
scabug opened this issue Oct 14, 2011 · 3 comments
Open

Partial application of curried functions using infix #5073

scabug opened this issue Oct 14, 2011 · 3 comments
Milestone

Comments

@scabug
Copy link

scabug commented Oct 14, 2011

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

@scabug
Copy link
Author

scabug commented Oct 14, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5073?orig=1
Reporter: Luigi Plinge (rbj2001)
Affected Versions: 2.9.0-1, 2.9.1
Duplicates #1980

@scabug
Copy link
Author

scabug commented Oct 14, 2011

@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.

@som-snytt
Copy link

I'll try to follow up in scala/scala#7741 which possibly makes it worse if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants