In Clojure we have many types of collections: lists, vectors, maps, and sets. Each of these collections is also a sequence. Clojure provides an interface that is known as the sequence abstraction, and it is this abstraction that allows multiple types of built-in functions to work uniformly across these different collection types.
Before we get into the sequence abstraction, let’s start with a task that is common when programming in Clojure, which is the need to loop over a collection in order to carry out some form of side effect. Consider the following example (Listing 4-1), where we loop over a list ...