...

/

The reduce Function

The reduce Function

Learn about the reduce function in the Flow module.

Introduction

In addition to map and filter, the reduce function in the Enum module is another frequently used tool when working with data. It is also the backbone of other functions in this module, including group_by, uniq_by, and take_sort. This section shows how to use Flow.reduce/3 to count the number of working airports in each country present in the dataset, in parallel. Then, we’ll move on to other convenience functions to group and sort data.

How reduce works

Before we begin, it’s useful to understand how ...