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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:21:01+00:00 2026-05-17T15:21:01+00:00

I think this is somewhat related to this question , but being not sure

  • 0

I think this is somewhat related to this question, but being not sure and since there’s no real answer there, here I go:

in Scala there’s you can write code such as:

aStringArray.map(_.toUpperCase())

which is shorthand for:

aStringArray.map(s => s.toUpperCase())

Is there anything like this in F# or a way to implement it (without the ? operator or heavy use of reflection)? If that’s not possible, is this being considered as a language feature for a future version? (I really the verbosity of functions just to call a method on an object in a closure!).

  • 1 1 Answer
  • 1 View
  • 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-17T15:21:01+00:00Added an answer on May 17, 2026 at 3:21 pm

    As Dario points out, a feature like _.Foo() syntax in Scala is not currently available in F#, so you’ll have to write a lambda function explicitly using fun a -> a.Foo().

    As far as I know, a question like this appears every now and then on F# discussions, so it was surely considered by the F# team. It is a bit tricky (e.g. do you want to allow just member uses or other uses e.g. _ + 10, and what would be the scope of the lambda expression?) Also, the value of the feature is relatively low compared to other things that could be done… Anyway, it would be nice to have it!

    This may be also a reason why many F# types expose operations as both members (usable in the OO style) and functions in a module (for the functional style). I think you could consider it as a good F# practice (but it depends on your design preferences). E.g.:

    type Foo(a:int) = 
      member x.Add(b:int) = a + b
    
    // Attribute allows you to define module with the same name
    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
    module Foo = 
      let add b (v:Foo) = v.Add(b)
    

    Then you can use both fun v -> v.Add(10) and Foo.add 10 to create a function value. Unfortunately, the String type doesn’t have corresponding module with all the functions in the core F# libraries, so you’d have to write it yourself.

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

Sidebar

Related Questions

This is not 100% programming related. But I think this is somewhat useful because
[This question is somewhat related to this question , but the answers are not...]
Although somewhat related to this question , I have what I think is a
I think this could be a very easy question for you. But I have
(I think this is a pretty basic question on OOP, but unfortunately I wasn't
I think this question has been asked many a times but I've been searching
Hey this may be a somewhat simple question, but I'm new to Eclipse and
Note: Sorry this is not exactly a programming question; please migrate it if there
This question is somewhat related to this. I want to have document storage along
First off, I think this is somewhat ridiculous to do but the other members

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.