Created
January 5, 2015 22:24
-
-
Save ataugeron/ef50454ba9d4abed07de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func myPrint(str: String, #completion: () -> ()) { | |
println(str) | |
completion() | |
} | |
let words = ["foo", "bar", "baz"] | |
let finalCompletion = { println("Done") } | |
let myFunc = reduce(reverse(words), finalCompletion) { | |
completion, word in | |
return { myPrint(word, completion: completion) } | |
} | |
myFunc() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment