Just sharing some of my inconsequential lunch conversations with you... RSS  

Friday, October 19, 2007

Anonymous Recursion in C#

Here's a great post about anonymous recursion in C#. He shows us how to get to a clean:


Func fib =
Y(f => n => n > 1 ? f(n - 1) + f(n - 2) : n);



The question I'll have to ask is: as C# 3 doesn't natively support this construct, shouldn't the Y fixed-point combinator implementation be integrated into the class library?

No comments:

Development Catharsis :: Copyright 2006 Mário Romano