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

  • Home
  • SEARCH
  • 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 7699771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:33:26+00:00 2026-05-31T22:33:26+00:00

In Twitter’s Scala school collections section , they show a Map with a partial

  • 0

In Twitter’s Scala school collections section, they show a Map with a partial function as a value:

// timesTwo() was defined earlier.
def timesTwo(i: Int): Int = i * 2
Map("timesTwo" -> timesTwo(_))

If I try to compile this with Scala 2.9.1 and sbt I get the following:

[error] ... missing parameter type for expanded function ((x$1) => "timesTwo".$minus$greater(timesTwo(x$1)))
[error]     Map("timesTwo" -> timesTwo(_))
[error]                                ^
[error] one error found

If I add the parameter type:

Map("timesTwo" -> timesTwo(_: Int))

I then get the following compiler error:

[error] ... type mismatch;
[error]  found   : Int => (java.lang.String, Int)
[error]  required: (?, ?)
[error]     Map("timesTwo" -> timesTwo(_: Int))
[error]                    ^
[error] one error found

I’m stumped. What am I missing?

  • 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-31T22:33:27+00:00Added an answer on May 31, 2026 at 10:33 pm

    It thinks you want to do this:

     Map((x: Int) => "timesTwo".->timesTwo(x))
    

    When you want this:

     Map("timesTwo" -> { (x: Int) => timesTwo(x) })
    

    So this works:

     Map( ("timesTwo", timesTwo(_)) )
     Map("timesTwo" -> { timesTwo(_) })
    

    Note this is not an usual error, see

    • https://stackoverflow.com/a/7695459/257449.
    • Scala underscore – ERROR: missing parameter type for expanded function

    (and probably more)

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

Sidebar

Related Questions

$.getJSON('http://twitter.com/followers/ids.json?screen_name=' + query1 + '&callback=?', function (data) { console.log('JSON data string 1 is: '
On twitter (new twitter) and facebook they now have the the ability to load
In twitter iPhone app, on My Profile view, there is a section with two
https://twitter.com/intent/tweet?source=webclient&text=G%C5 produces the following error: Invalid Unicode value in one or more parameters btw,
How Twitter make Facebook's access tokens timeless and they do not become obsolete. Or
using twitter bootstrap typeahead i get google chrome suggestion list above typeahead list $(document).ready(function
Twitter's REST API returns a in_reply_to_status_id value for tweet statuses, yet the Search API
On twitter they have a login link and when js is enabled jquery shows
in twitter-compatible API what is setAPIRootURL value ? twitter=new Twitter(username,password); twitter.setAPIRootUrl(http://yamba.marakana.com/api); JTwitter library home
I've used several Twitter apps and they all seem to shorten URLs using the

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.