-
Book Overview & Buying
-
Table Of Contents
Learning F# Functional Data Structures and Algorithms
By :
You may recall that we discussed enumerations and sequences in Chapter 3, What's in the Bag Anyway, where we explain sequences as Schrödinger's lists, that is, a data structure that contains elements that are evaluated on demand. Under the covers, the sequence seq<'T> or 'T seq is just IEnumerable<'T> for a generic type T, which is now a commonly used construct since the introduction of LINQ to the .NET Framework. It won't be incorrect to say that introducing LINQ to .NET was the beginning of functionalization of C#. Many functional features you see in C# nowadays are borrowed from, or have been cross-pollinated during, F# development and subsequent integration with CLR.
In the .NET framework class library, IEnumerable<'T> is defined as an interface that exposes an enumerator to iterate over a collection. An interface provides a relationship to the type, and is basically a collection of attributes and methods. It serves as a contract...