Summary
In this chapter, we started with the category theory concepts such as Functor, Applicative Functor, and Monad, and explored higher-order functions such as map, filter, flatMap, joined, and reduce. Then, we examined Swift-provided versions of higher-order functions and implemented a simple version ourselves. Also, we developed map, filter, flatMap, and flatten functions in terms of the reduce function.
Then, we continued with the apply, join, and zip functions and were introduced to chaining higher-order functions.
Finally, we explored some practical examples of higher-order functions such as removing nil values from an array, removing duplicates, and partitioning arrays.
These functions are going to be great tools in our day-to-day ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access