Recursive lambda expressions
I feel it very neccessary at this point to warn you that this is most certainly not for the faint hearted ... As the author, Dr T., of the original post says; this might not be practical but it sure is fun.
"People sometimes complain that you cannot write a lambda expression that is recursive. Good old factorial, for instance, how to write that as a lambda expression? " .... [read more]
believe it or not, but the line below is the single simple lambda function to implement the good old factorial problem;
i => new Func<Func<int,int>,Func<int,int>>(fac => x => x == 0 ? 1 : x * fac(x - 1))(new SelfApplicable<Func<Func<Func<int,int>,Func<int,int>>,Func<int,int>>>(y => f => x => f(y(y)(f))(x))(y => f => x => f(y(y)(f))(x))(fac => x => x == 0 ? 1 : x * fac(x - 1)))(i)
I'm imagining all sorts of higher job security with this; just think of the possibilities..... 
Ok, my head hurts after that .... need to get more coffee.
