Use Higher-Order Functions
Another defining feature of a functional language is making functions first-class citizens. That means that not only is it possible to have functions attached to objects or structures or enums (or even inside of functions), it is also possible to have variables or constants that point to functions, to pass functions into other functions, and to return functions from functions. It is not something languages like Java can do at all. Objective-C made great strides with block syntax, and has always had use of C functions, but Swift provides even more power and much clearer syntax for dealing with functions.
The point of this power and clarity is to attack problems at a higher conceptual level. Instead of thinking about ...
Get Functional Programming: A PragPub Anthology now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.