Swift 3 Functional Programming