Ever since Swift came out, I keep seeing weird comments that Swift is a functional programming language. I’ve puzzled a bit over why anyone would say that, since there’s really very little “functional” about Swift. It’s a pretty traditional object oriented language with a focus on generic programming.
I’m saying that a taxonomy that groups together Swift and Haskell because they have map is no more useful than grouping Wangga, Opera, and Rock together because they have vocalists.
Functional programming is primarily concerned with decomposing problems into functions that accept and return immutable values. Its usual structure is a collection of functions that transform values into other values, and various ways to combine functions. It avoids mutable state and does not require that the evaluation of functions occur in any particular order. Functional programming treats a program as a math problem rather than a series of operations. When faced with a problem, the functional question is “what kinds of values need to be transformed in what ways to solve this?”