Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6691527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:45:44+00:00 2026-05-26T05:45:44+00:00

In other words, is there a good reason why this shouldn’t compile? def f(xs:

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:45:44+00:00Added an answer on May 26, 2026 at 5:45 am

    I fixed this just now, but I can’t check it in yet because it requires amending the specification.

    scala> def f(xs: List[Int]) = (0 /: xs) _
    f: (xs: List[Int])(Int, Int) => Int => Int
    
    scala> f(1 to 10 toList)
    res0: (Int, Int) => Int => Int = <function1>
    
    scala> res0(_ + _)
    res1: Int = 55
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In other words, is there a way to rewind it to the beginning? EDIT
Are there any APIs available in Java to query jobs? In other words, I
This code works (C# 3) double d; if(d == (double)(int)d) ...; Is there a
I wonder if these words are synonymous with each other?
In other words, given a base class shape and a derived class rectangle :
In other words, I have a string like: anything, escaped double-quotes: \, yep anything
In other words, can I do something with a volatile variable that could not
In other words, if I fill two unordered_map , or unordered_set , objects with
In other words, when I do nnet(...) I can use the size parameter to
In other words what's the difference between onclick=myFunction() and onclick=JavaScript:myFunction()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.