In the previous chapter, we had an overview of Functional Programming (FP) and the Swift programming language. It introduced some of the key concepts of functions. As functions are the fundamental building blocks in FP, this chapter dives deeper into the subject and explains all the aspects related to the definition and usage of functions in Swift and FP, together with coding examples.
This chapter starts with the Swift function and method syntax, continues with other related topics such as function types and tuples, and finally concludes with FP topics such as first-class functions, higher-order functions, function composition, closures, currying, recursion, and memoization.
This chapter will cover the following topics by coding examples:
- General syntax of functions
- Defining and using function parameters
- Setting internal and external parameters
- Setting default parameter values
- Defining and...