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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:25:38+00:00 2026-05-12T20:25:38+00:00

C# has anonymous delegates. So I can write: public vois foo(string d, Action t){

  • 0

C# has anonymous delegates. So I can write:

public vois foo(string d, Action t){
    t();
}

In ruby:

def foo d
  yield
end

How to do the same in F#? Prefered syntax is:

foo "dfdfdf" { do something here }

Thanks

  • 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-12T20:25:38+00:00Added an answer on May 12, 2026 at 8:25 pm

    Your first example isn’t an anonymous method — it’s just passing and calling through a delegate (which might refer to a named or an anonymous method). To do this in F#, just provide and call a function argument:

    let foo n f = f n
    
    let square n = n * n
    let result = foo 123 square
    printfn "%A" result
    

    To create the equivalent of an anonymous method in F#, use the fun keyword:

    let result2 = foo 123 (fun n -> n * n)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone ever run into this issue before? Sometimes the string displays, sometimes half
I'm currently trying to connect to a webservice placed on https://xxx.xxx.xx/myapp It has anonymous
I'm wondering if Python has anything like the C# anonymous classes feature. To clarify,
I have an interface. type IProgressObserver = interface(IInterface) procedure ReportProgress(Progress:Integer); procedure ReportError(Message:string); end; I
It has been said that C# can be regarded as a functional programming language,
Situation : C#, .NET 3.5, WinForms Objective : Form1 has a Button that can
I have a asmx web service running on a test server that has anonymous
I am attempting to pass a collection of anonymous types which has in itself
I was trying to understand the evolution of delegates. And how best can this
Has anyone ever used the hidden class PackageParser in Android source code with java

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.