In this chapter, we're going to discuss basic principles of functional programming, and how they fit into the Kotlin programming language. We won't introduce much new syntax, as you'll soon see. It would have been hard to discuss benefits of the language in the previous chapters without touching on concepts such as data immutability and functions as first-class values. But, as we did before, we'll look at those features from a different angle: not how to use them to implement well-known design patterns in a better way, but their purpose.
In this chapter, we will cover the following topics:
- Why functional programming?
- Immutability
- Functions as values
- Expressions, not statements
- Recursion