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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:12:23+00:00 2026-05-13T22:12:23+00:00

Please interpret this code : public static Func<TInput1, TOutput> Curry<TInput1, TOutput>(this Func<TInput1, TOutput> f)

  • 0

Please interpret this code :

public static Func<TInput1, TOutput> Curry<TInput1, TOutput>(this Func<TInput1, TOutput> f)
{
    return x => f(x);
}

OR

Func<Int32, Int32> SubtractOne = x => x - 1;

what is the name of these techniques?

  • 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-13T22:12:23+00:00Added an answer on May 13, 2026 at 10:12 pm

    The first snippet would only make sense if accompanied by several similar overloads. It’s probably just to complete a set of methods called Curry. This word comes from the name Haskell Curry and refers to the ability in a programming language (or library) to supply a subset of the required parameters to a function in order to obtain another function that accepts the rest of the functions. It’s easier to understand with an example:

    void Foo(int a, string b, bool c) { ... }
    

    You can call this supplying all three parameters:

    Foo(123, "hi", false);
    

    But in currying, you can do this:

    var foo123 = Foo(123);
    

    It gives you back another function that takes the remaining two parameters, so we say that it “binds” the first parameter to the value 123. But if you can curry with the original function, you can curry with the new one:

    var foo123Hi = foo123("hi");
    

    And finally supply the last argument:

    foo123Hi(false);
    

    At last we have all three arguments and only now does our definition of Foo actually execute for real.

    In many functional languages (unsurprisingly in the languages Haskell and Curry) this is built into the language. In C# it is not, although you can partly simulate it by providing a set of overloads such as:

    Action<string, bool> Foo(int a)
    {
        return (b, c) => Foo(a, b, c);
    }
    
    Action<bool> Foo(int a, string b)
    {
        return c => Foo(a, b, c);
    }
    

    But this still isn’t quite right, because in the first example the returned Action<string, bool> will not be directly curry-able.

    So there are sometimes attempts to provide a currying library that will enable currying on any function.

    But with a sufficiently simple lambda syntax it is not actually clear that any library solution will be that helpful. After all, a lambda is a very simple way to bind one parameter, as shown in the above examples. So I’m not sure how widely used a “Curry” method library would be. The => operator is clearer, less clunky, more powerful and readable, and already built-in.

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

Sidebar

Ask A Question

Stats

  • Questions 321k
  • Answers 321k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is probably down to the different ways LINQ handles… May 14, 2026 at 12:37 am
  • Editorial Team
    Editorial Team added an answer If the .cgi extension isn't already mapped to the cgi… May 14, 2026 at 12:37 am
  • Editorial Team
    Editorial Team added an answer Collections.shuffle? That won't help directly with an array, but if… May 14, 2026 at 12:37 am

Related Questions

I would like to retrieve the incoming call's phonenumber and do something with it
I got this javascript code from off the internet. It's a script that changes
I am streaming a PDF to the browser in ASP.NET 2.0. This works in
The following source code alerts the following results: Internet Explorer 7 : 29 Firefox
I can't get IE padding around my <a> tags to work correctly. This only

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top 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.