Skip to content

Instantly share code, notes, and snippets.

@Ben-G
Created June 8, 2015 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ben-G/ed1586704f4cbacbaa56 to your computer and use it in GitHub Desktop.
Save Ben-G/ed1586704f4cbacbaa56 to your computer and use it in GitHub Desktop.
"Optional chaining for functions" using map and curried functions
var a: String? = "a"
var b: String? = "b"
func twoParamFunction(a: String)(b:String) {
println("\(a)\(b)")
}
a.map(twoParamFunction).map { b.map($0)}
@Ben-G
Copy link
Author

Ben-G commented Jun 25, 2015

?twoParamFunction(nil, nil)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment