Functional Swift: Updated for Swift 4