This chapter is about functions and macros for sequential processing. These functions typically transform their input into a sequence (if it’s not already) and produce another sequence. Although sequential functions can be used with any collection type offering a sequential interface, they tend to perform at their best with pure sequential input/output.
Sequential processing can be broadly categorized as follows:
- Partitioning: isolate a consecutive portion of the sequence by index, number of items, or using a custom predicate.
- Selection: retrieve items from the sequence but not necessarily as a consecutive selection.
- Transformation: apply a function to each item in the sequence to produce another sequence.
- Combining: combination of multiple sequences to form another sequence.
- Chunking: process a sequence by groups of multiple elements instead of one at a time.
If we look at the partitioning operations in particular, there are many of them. Their naming convention is consistent but it might be confusing to pick the right function. For this reason, partitioning functions has been further divided into groups: