Implementing a Haskell like fold and map in vanilla C#