News for hackers. Stuff that matters.
Re:I finally understand why I'm not allowed to use Lisp by thomasz on Sunday February 20, 2011 @11:14AM (#2242170)
This was written in May 2007. C# 3.0 was released in August. We are talking about c# 2.0 here. No Lambda syntax, no Linq, no Type Inference, no nothing. Anonymous methods were clearly intended to handle events, and even that was discouraged in favor of On_SomethingHappend(...) methods in the MSDN docs.

His code must have looked like this:

    public delegate TResult Func<T,TResult>(T input);
    public delegate TResult Func<T,U,TResult>(T inputA, U inputB);
    
    public static TResult Fold<TAcc,T>(IEnumerable<T> collection, TAcc state, Func<TAcc,T,TAcc> f) 
    {
        TAcc acc = state;
        foreach(T item in collection) 
        {
            acc = f(acc,item);
        }
        return acc;
    }
    //[...]
    public int FunctionalMasturbation() 
    {
        int totalWithdrawed = Fold<int,int>(0,_withdrawals,
                delegate(int acc, int value) 
                {
                    return value+acc;
                }
        );
        //...
    }
This is an abomination. Right, for developers with a background in FP, than it's pretty clear what's going on, even if it looks like puke. But in 2007 you could hold a conference for all .net devs with knowledge of Functional Concepts in a telephone booth.

There are no comments on this comment yet.