Chapter 10. Efficiency of data structures

This chapter covers

  • Optimizing and improving recursive functions
  • Using tail-recursion and continuations
  • Working efficiently with lists and arrays

So far in this book, we’ve used functional techniques such as recursion and functional data structures like immutable lists. We’ve written the code in the most straightforward way we could, using the basic F# collection type (a list) and expressing our intentions directly. This works very well in many situations, but when it comes to processing large data sets, “obvious” code sometimes leads to performance problems. In this chapter, we’ll look at techniques for writing code that work regardless of the size of the input and examine ways to optimize the performance ...

Get Real-World Functional Programming with Examples in F# and C# now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.