O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required