5. Many to One: Reducing

Overview

In this chapter, you will learn new techniques for dealing with sequential data. You will learn how to use the reduce function, as well as other reducing techniques that provide greater flexibility for transforming or extracting data from a sequence. We will use the simple form of reduce, use reduce with an initializer and an accumulator, and solve problems requiring a variable-length "window" over a sequence. We will also reduce sequences with functions other than reduce.

By the end of this chapter, you will be able to use reduce with complex accumulators.

Introduction

This chapter is about using Clojure's reduce function and about reducing in general. By that, we mean starting with a sequence and boiling ...

Get The Clojure Workshop 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.