About This Title

Pages: 726
Published: December 2020
ISBN: 9781944994013
Edition: 1
In Print

A Functional Programming Kickstart

Introducing Functional Programming Fundamentals in Swift

by Daniel H Steinberg

There’s nothing natural about Functional Programming. It’s awkward, it feels funny…

And then one day you start to see the world differently and you can’t remember what was so difficult.

A Functional Programming Kickstart is a hands-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 no time you’ll be creating and using higher-order functions, embracing value types, avoiding side-effects, and digging deep into map(), flatMap(), and apply().


This work was written and produced entirely by the author. We are proud to be distributing it.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $30.00 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal


You use functions and methods to get things done but have you ever thought that those things you do with Strings, Ints, and other types can also be done with functions. We begin this book by learning how to construct functions that are safe to use and to pass around.

Pass around?

Sure. You can store functions as properties, create functions that return other functions, and create and use functions that accept other functions. In no time this book will have you creating these so-called higher-order functions and exploring many provided for you in the Swift Standard Library.

Once you’ve explored map() and flatMap() for Arrays you are prepared to take things to a whole other level. We work to see map() and flatMap() as design patterns and not just as functionality we’re given for collections. We’ll see map() as pattern by extending examples provided for Array, Optionals, and the Result type. Once you have the big idea of map() down you’ll understand all the fuss about functors.

This prepares you to look at flatMap() and see how map() allows us to transform a result but flatMap() allows us to interact with our environment. In addition to built in types, and illustrative types we explore the Writer, Reader, and State monads. Understanding this broader context will help you apply the standard bits of the standard library with more confidence and prepare you to master the Combine frameworks.

What You Need

You need a Mac running the latest public version of Xcode.

Resources

Releases:

  • P1.0 2020/12/02

Contents & Extracts

  • Copyright and Legal
    • Copyright
    • Book Version
    • Code Download
    • Recommended Settings
    • Submit Errata
    • Official Links
    • Legal
  • Chapter 1: Magic
    • The Trick
    • A Card
    • The Mutating Card
    • The Non-Mutating Card
    • Changing a Card
    • Destroy and Restore a Card
    • The Deck
    • Performing the Trick
    • Road Map
    • Credits, Bio, and Version History
  • Chapter 2: Functions aren’t special
    • Pure Functions
    • Trick Deck
    • A Simple Label
    • A Simple Button
    • Mutating State
    • Displaying Cards
    • Mutable Middle
    • One for Fun
  • Chapter 3: Higher-Order Functions
    • Lines
    • Making Functions
    • Closures
    • Making Closures
    • Consuming Closures
    • Generics
    • Call as Function
    • Custom Operators
    • Flexible Trick
  • Chapter 4: Arrays
  • Chapter 5: Map
    • The Magic of Map
    • One at a Time
    • Zero or One
    • Optionals
    • Result
    • Writer
    • The Map Pattern
    • The Magic of Map Revealed
  • Chapter 6: FlatMap
    • The Magic of FlatMap
    • Writer
    • Shiny Trunk
    • Result
    • Optionals
    • The shape of map and flatMap
    • Just
    • Monoids
  • Chapter 7: Apply
    • The Magic of Apply
    • Arrays
    • The Interchange Law
    • Currying
    • Optionals
    • Between Functor and Monad
    • Result
    • Validated
  • Chapter 8: Deeper Magic
    • String Function
    • Reader
    • The Reader Monad
    • Parsers
    • State
    • The State Monad
    • So…

Author

Daniel H Steinberg is the author of more than a dozen books including the best selling books A SwiftUI Kickstart, A Swift Kickstart, Second Edition and Dear Elena. He has written apps for the iPhone and the iPad since the SDKs first appeared and has written programs for the Mac all the way back to System 7.

Daniel presents iOS, Functional Programming, SwiftUI, and Swift training and consults through his company Dim Sum Thinking. When he’s not coding or talking about coding for the Mac, the iPhone, and the iPad he’s probably cooking, baking bread, or hanging out with friends. Details on his training and speaking are on the Dim Sum Thinking website.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $30.00 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal

Related Titles:

About This Title

Pages: 726
Published: December 2020
ISBN: 9781944994013
Edition: 1
In Print