Higher-Order Functions: map, flatMap, compactMap
Transforming sequences without mutation using Swift's collection functions.
Welcome
Higher-order functions take or return other functions. Swift's collection library is built on them: `map`, `flatMap`, `compactMap`, `filter`, `reduce`.
map — Transform Each Element
```swift
let nums = [1,2,3,4]
let squared = nums.map { $0 * $0 } // [1,4,9,16]
let strs = nums.map(String.init) // ["1","2","3","4"]
```
All lessons in this course
- Pure Functions and Side-Effect-Free Design
- Higher-Order Functions: map, flatMap, compactMap
- Function Composition and Pipelines
- Lazy Sequences for Efficiency