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 8745607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:03:29+00:00 2026-06-13T12:03:29+00:00

In my code, I have the following: type Occurrences = List[(Char, Int)] def subtract(x:

  • 0

In my code, I have the following:

  type Occurrences = List[(Char, Int)]

  def subtract(x: Occurrences, y: Occurrences): Occurrences = {
    val yMap = y.toMap
    x foldLeft (List[(Char, Int)]()) {  // ERROR
        case (a: List[(Char, Int)], xe: (Char, Int)) =>
        if(yMap.contains(xe._1)) (xe._1 -> (xe._2 - yMap(xe._1))) :: a
        else a
    }
  }

It fails on compile-time, at the { that is right before the error mark in the code. The error message is the following:

missing parameter type for expanded function The argument types of an
anonymous function must be fully known. (SLS 8.5) Expected type was:
Int

1) How could that be? As far as I can see, there is no room for misinterpretation of type information here, and I find a lot of such examples over the internet. How can I fix that?

2) Why is it thinking that the expected type is Int after all?

  • 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-06-13T12:03:30+00:00Added an answer on June 13, 2026 at 12:03 pm

    The error occurs because you wrote xs foldLeft (init) (f) instead of (xs foldLeft init)(f) or xs.foldLeft(init)(f).

    The former does not work, because Scalas operator notation rules allow only to leave the dot and parentheses if a call occurs in form obj method param, which is not the case with foldLeft because it has two parameter lists.

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

Sidebar

Related Questions

I have the following piece of code where check is for char type do{
I have following Delphi code: type RegbusReq2=packed record Funct:char; Device:char; Device1:char; Starting:integer; Quantity:smallint; _CRC:Word;
I have following code #include <stdio.h> #include<ctype.h> typedef struct { int Type; int Type2;
I have the following code: Type type = typeof(T); foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Public
I have the following code: $.ajax({ type: 'GET', url: 'index.php?route=checkout/onepagecheckout/getpaypaldata', dataType: 'json', success: function(json)
I have the following code to get the object type of a collection: Dim
I have the following code to convert the type of the matrix using cv::Mat.convertTo()
I have the following Powershell code: Add-Type -Assembly System.Configuration [ExeConfigurationFileMap] $configMap = New-Object ExeConfigurationFileMap
I have the following code TransitionManager.start(babyPreloader,{type:Fade, direction:Transition.OUT, duration:0.5, easing:Regular.easeOut}); var tempPreloader:DisplayObject = babyPreloader as
I have The following code for now. type TByte4 = array[0..3] of Byte; //

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.