O'Reilly logo

Functional Programming: A PragPub Anthology by Michael Swaine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Functional Swift

The really cool new stuff in Swift is all functional programming features. There are two main facets to Swift’s version of functional programming: managing mutability, and first-class functions and closures.

Managing Mutability

In programming, you can’t avoid mutable state. It’s a fact. Most of the time, it’s the reason that we’re using a computer. For example, say I’m using a program called Atom to write a blog post. There wouldn’t be any point in using Atom if I couldn’t modify the file I’m writing.

But mutable state makes things complicated. In a large, complex software system, code that avoids mutating things is usually easier to understand, less prone to errors and unexpected side effects, and easier to interact with. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required