Chapter 5. Designing programs with function composition

This chapter covers

  • Defining workflows with function composition and method chaining
  • Writing functions that compose well
  • An end-to-end example of handling server requests with workflows

Function composition is not only powerful and expressive but also pleasant to work with. It’s used to some extent in any programming style, but in FP it’s used extensively. For example, have you noticed that when you use LINQ to work with lists, you can get a lot done with only a few lines of code? That’s because LINQ is a functional API, designed with composition in mind.

In this chapter we’ll cover the basic concept and techniques of function composition and illustrate its use with LINQ. We’ll also ...

Get Functional Programming in C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.