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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:36:43+00:00 2026-05-11T13:36:43+00:00

I was playing with recursive lambdas in C# and have found two approaches to

  • 0

I was playing with recursive lambdas in C# and have found two approaches to do this on the web. One approach uses fixed point combinator and the other does not. In the code below f1 is built using combinator, and f2 is defined directly. My question is, do we need fixed point combinators in C# or the language already provides all we need, so we can leave them alone?

class Program {     static Func<T, T> F<T>(Func<Func<T,T>,Func<T,T>> f)     {         return x => f(F(f))(x);     }      static void Main(string[] args)     {         Func<Func<int,int>,Func<int,int>> f = fac => x => x == 0 ? 1 : x * fac(x - 1);         var f1 = F(f);          Console.WriteLine(f1(5));          Func<int, int> f2 = null;         f2 = x => x == 0 ? 1 : x * f2(x - 1);          Console.WriteLine(f2(5));     } } 
  • 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. 2026-05-11T13:36:43+00:00Added an answer on May 11, 2026 at 1:36 pm

    As we can give a name to a method, that means that the language already has the necessary support for recursion built into it.

    Note that the second method given in your question involves changing the value of a variable after it has been introduced, making it not ‘pure’ functional programming. Y-combinator is only necessary if your system of functional calculus doesn’t have a built-in notion of a function that can refer to its own definition by name before the definition is completely defined. C# has two ways to do that directly: 1. initially defining the function variable as null and 2. declaring an ordinary named method (by far the preferred technique).

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

Sidebar

Related Questions

I have two tables that look a little like this AGR_TERR_DEF_TERRS ID DEF_ID TERRITORY_ID
Im playing a little bit with heavy-client app. Imagine I have this model: class
I have a basic text template engine that uses a syntax like this: foo
Playing a little with coffeescript and Rails 3.1.0.rc4. Have this code: yourMom = (location)
I was playing around with recursion and did this simple function. I was assuming
Playing with log4net, I have seen the possibility to use a per-thread stack of
Playing with the new(ish) url rewriting functionality for web forms, but I'm running into
While playing around with regexps in Scala I wrote something like this: scala> val
I just started playing with lambdas and Linq expression for self learning. I took
Quite stumped on this one. I am using the Youtube JS API to determine

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.