15 Advanced functional programming

 

This chapter covers

  • Functional Programming Concepts
  • Limits of FP in Java
  • Kotlin advanced FP
  • Clojure advanced FP

We have already met functional programming concepts earlier in the book, but in this chapter we want to draw together the threads and step it up.

There is a lot of talking about functional programming in the industry but it remains a rather ill-defined concept.

The sole point that is agreed upon is that in a functional programming language (FP) code is representable as a first class data item - i.e. that it should be possible to represent a piece of deferred computation as a value that can be assigned to a variable.

This definition is, of course, ludicrously broad - for all practical purposes every mainstream language (with very few exceptions) in the last 30 years meets this definition. So, when different groups of programmers discuss FP, they are talking about different things. Each tribe has a different, tacit understanding of what other language properties are implicitly understood to also be included under the term "FP".

In other words - just as with OO - there is no fundamentally agreed-upon definition of what a "functional programming language" is. Alternatively - if everything is a FP language, then nothing is.

15.1 Introduction to functional programming concepts

15.1.1 Pure functions

15.1.2 Immutability

15.1.3 Higher-order functions

15.1.4 Recursion

15.1.5 Closures

15.1.6 Laziness

15.1.7 Currying and partial application

15.2 Limitations of Java as a FP language

15.2.1 Pure functions

15.2.2 Mutability

15.2.3 Higher-order functions

15.2.4 Recursion

15.2.5 Closures

15.2.6 Laziness

15.2.7 Currying and partial application

sitemap