Skip to content

Instantly share code, notes, and snippets.

@ataugeron
Created January 5, 2015 22:24
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 ataugeron/ef50454ba9d4abed07de to your computer and use it in GitHub Desktop.
Save ataugeron/ef50454ba9d4abed07de to your computer and use it in GitHub Desktop.
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