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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:12:29+00:00 2026-05-11T04:12:29+00:00

I read This article and i found it interesting. To sum it up for

  • 0

I read This article and i found it interesting.

To sum it up for those who don’t want to read the entire post. The author implements a higher order function named Curry like this (refactored by me without his internal class):

 public static Func<T1, Func<T2, TResult>>               Curry<T1, T2, TResult>(this Func<T1, T2, TResult> fn)  {      Func<Func<T1, T2, TResult>, Func<T1, Func<T2, TResult>>> curry =       f => x => y => f(x, y);      return curry(fn);  } 

That gives us the ability to take an expression like F(x, y) eg.

Func<int, int, int> add = (x, y) => x + y; 

and call it in the F.Curry()(x)(y) manner;

This part i understood and i find it cool in a geeky way. What i fail to wrap my head around is the practical usecases for this approach. When and where this technique is necessary and what can be gained from it?

Thanks in advance.

Edited: After the initial 3 responses i understand that the gain would be that in some cases when we create a new function from the curried some parameters are not re evalued. I made this little test in C# (keep in mind that i’m only interested in the C# implementation and not the curry theory in general):

public static void Main(string[] args) {     Func<Int, Int, string> concat = (a, b) => a.ToString() + b.ToString();     Func<Int, Func<Int, string>> concatCurry = concat.Curry();     Func<Int, string> curryConcatWith100 = (a) => concatCurry(100)(a);      Console.WriteLine(curryConcatWith100(509));     Console.WriteLine(curryConcatWith100(609)); }      public struct Int     {         public int Value {get; set;}          public override string ToString()         {              return Value.ToString();         }          public static implicit operator Int(int value)         {             return new Int { Value = value };         }     } 

On the 2 consecutive calls to curryConcatWith100 the ToString() evaluation for the value 100 is called twice (once for each call) so i dont see any gain in evaluation here. Am i missing something ?

  • 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. 2026-05-11T04:12:30+00:00Added an answer on May 11, 2026 at 4:12 am

    Its easier to first consider fn(x,y,z). This could by curried using fn(x,y) giving you a function that only takes one parameter, the z. Whatever needs to be done with x and y alone can be done and stored by a closure that the returned function holds on to.

    Now you call the returned function several times with various values for z without having to recompute the part the required x and y.

    Edit:

    There are effectively two reasons to curry.

    Parameter reduction

    As Cameron says to convert a function that takes say 2 parameters into a function that only takes 1. The result of calling this curried function with a parameter is the same as calling the original with the 2 parameters.

    With Lambdas present in C# this has limited value since these can provide this effect anyway. Although it you are use C# 2 then the Curry function in your question has much greater value.

    Staging computation

    The other reason to curry is as I stated earlier. To allow complex/expensive operations to be staged and re-used several times when the final parameter(s) are supplied to the curried function.

    This type of currying isn’t truely possible in C#, it really takes a functional language that can natively curry any of its functions to acheive.

    Conclusion

    Parameter reduction via the Curry you mention is useful in C# 2 but is considerably de-valued in C# 3 due to Lambdas.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The accuracy of the time.sleep function depends on your underlying… May 12, 2026 at 6:09 am
  • Editorial Team
    Editorial Team added an answer Actually i found the solution. the tableview has a property… May 12, 2026 at 6:09 am
  • Editorial Team
    Editorial Team added an answer I suggest building a Dictionary<string, Operation> to map friendly names… May 12, 2026 at 6:09 am

Related Questions

I am trying to write a Java applet that will read from a user's
I recently read the excellent article The Transactional Memory / Garbage Collection Analogy by
Before I get flamed and down-voted without mercy, my company will not allow the
I love C#, I love the framework, and I also love to learn as

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.