O'Reilly logo

Get Programming with F#: A guide for .NET developers by Isaac Abraham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 18. Folding your way to success

The preceding few lessons covered the main collection types and how to use them. Here we’ll round off with a few scenarios describing how collections can be used in interesting ways to achieve outputs and transformations that you might not think possible through folding. You’ll look at

  • Understanding aggregations and accumulation
  • Avoiding mutation through fold
  • Building rules engines and functional chains

18.1. Understanding aggregations and accumulators

You’re likely already familiar with some of the aggregation functions in LINQ or F# collections, such as Sum, Average, Min, Max, and Count (see figure 18.1). All of these have a common signature: they take in a sequence of elements of type T and return ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required