

Beautiful Folding (2008) - brudgers
http://squing.blogspot.com/2008/11/beautiful-folding.html

======
rikkus
C# purely functional:

    
    
      Enumerable.Range(1, 10000000).Aggregate(
        new { Sum = 0L, Length = 0L },
        (agg, n) => new { Sum = agg.Sum + n, Length = agg.Length + 1 }
      )
    

C# side-effecting (executes in about 1/3 of the time):

    
    
      class Agg { public long Sum; public long Count; }
      Enumerable.Range(1, 10000000).Aggregate(
        new Agg(),
        (a, n) => { a.Sum += n; ++a.Count; return a; }
      );

