A C# version of the data structures from Chris Okasaki’s book Purely Functional Data Structures, coded as static functions to closely resemble the book’s description. This allows you to work through the examples, and follow the narrative, without having to understand Standard ML or Haskell. You can also fire these examples up in the debugger, to see the exactly how they tick. Or even, check the performance with modern tools, and compare them with other designs. Head on over to github.com FunProgramming to download the source code.

From the book:

Okasaki, Chris. Purely Functional Data Structures. Cambridge, U.K.: Cambridge UP, 1998. Print.

Features:

  • Abstract Data Types -> templates
  • Immutable data structures -> readonly data members
  • Lazy evaluation -> class Lazy<T>
  • Polymorphic recursion -> Static member functions
  • Structure dumping -> Only implemented in test code
  • Recursive structures -> Not supported (cut and paste for now)