A Functional Programming Kickstart

Introducing Functional Programming Fundamentals in Swift


Contents


  • Magic (on Immutability)

  • Functions aren't special

  • Higher-Order Functions

  • Arrays

  • Map

  • FlatMap

  • Zip and Apply

Related


Training from Dim Sum Thinking

Description


There's nothing natural about Functional Programming.

It's awkward, it feels funny, there's something not right about it ... and then one day you start to see the world differently and you can't remember what was so difficult.

This hand-on, fast-moving kickstart will provide you with a new set of skills that you can add to - not replace - your current favorite programming techniques.

In part one we look at the fundamentals of functional programming and some of the best practices.

Chapter 1: There are the old standbys:

  • favor immutability,

  • prefer value types over reference types, and

  • watch out for side-effects

Chapter 2: You'll learn that functions aren't special:

  • we can pass them around

  • we can store them in properties

Chapter 3: You play with higher-order functions:

  • create functions that accept other functions as parameters

  • return new functions from functions

  • play with closures, currying, and custom operators

Chapter 4: This is a palette cleanser between parts one and two.

  • we explore higher-order functions from the Swift Standard Library that work with Arrays

  • we experiment with combining some of these functions and methods to see how we might benefit from this functional approach

In part two we finish by looking in depth at some of those functions and extending them to functional design patterns:

Chapter 5: We look at map() as a pattern

  • we implement and use map() in a variety of types

  • you see the common pieces in the various map()s

  • you consider where you might want to add map() to your own types

Chapter 6: We look at flatMap() as a pattern

Chapter 7: We finish with two other common higher-order functions

This is a beta release that currently contains chapters 1 - 5

You can read the book in Apple's Books app on your iOS device or Mac or on any device that supports ePub if you buy the eBook from Gumroad.

Screenshots