1. Introduction to the FP Tutorial
Introduces functional programming, mentions some of the core ideas, and the main hurdle (lazy evaluation) that users of LINQ will have to jump.
Gives a quick overview of what the tutorial covers.
Capsule summary of query expressions and explicit notation.
Introduction to lambda expressions, their syntax, and their semantics. Lambda expressions are one of the key tools that you will use when doing functional programming.
Introduction to extension methods, and their applicability to functional programming.
Anonymous types are key to FP, and in certain circumstances, to use anonymous types, you must use local variable type inference.
To use anonymous types, you must use object and collection initializers. This introduces them.
Tuples are important for creating intermediate values (and sometimes final results) of queries. This introduces tuples as implemented via anonymous types.
Yield blocks are the foundation on which lazy evaluation is based. Yield blocks were introduced to C# in version 2.0.
10. Lazy Evaluation
This introduces and discusses what may be the most difficult hurdle that OO programmers must get over when using LINQ.
Aggregation is a core tool that you will use to develop results when using FP.
Introduces the idea of declarative programming (vs. imperative programming).
Presents an analog to the switch procedural construct.
14. Pure Functions
Refactoring in FP consists of creation of pure functions. This defines pure functions and tells why you want to use them.
15. Parsing WordML
This introduces our main example that we'll use in this tutorial. This example pulls together all of the previously introduced topics, including lambda expressions, extension methods, tuples (including type inference and object initializers), lazy evaluation, aggregation, and pure functions.
This topic contains the Word document that we'll parse using FP techniques.
Develops a query that returns all of the paragraphs in a Word document. Creates an intermediate result using an anonymous type.
Refactors the previously introduced query using a pure function. The resulting query is easier to read.
Modifies the query to retrieve the text of each of the paragraphs. Adds the text to the tuple.
Modifies the query to determine whether a paragraph is code or comment, or anything else.
Introduces a new query operator, GroupOnChange, implemented as an extension method on IEnumerable<T>.
Modifies the query to retrieve just the groups that we want.
15.8 The Final Results
Modifies the query to retrieve exactly what we want. This is the end target of this example.
Contains the complete listing of our example.
Introduces the idea of doing transformations in a functional programming style. Contains the code for the transformation.
Contains the source XML document for our transformation.
Final thoughts about functional programming.