LINQ in Action roller

How-To: Anonymous Recursion and Memoization

Those trying to implement Fibonacci or Factorial in lambdas will probably want to read this: http://blogs.msdn.com/wesdyer/archive/2007/02/02/anonymous-recursion-in-c.aspx The resulting types in the discussion are: // Recursive function delegate delegate R Recursive<A,R>(Recursive<A,R> r, A a); // Y fixed-point combinator static Func<A, R> Y<A, R>(Func<Func<A, R>, Func<A, R>> f) { Recursive<A, R> rec = r => a => f(r(r))(a); return rec(rec); } Read More...
Published Monday, February 5, 2007 8:44 PM by MSDN Forums: LINQ Project General
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication