Skip to content

Instantly share code, notes, and snippets.

@debreuil
Created June 7, 2014 00:47
Show Gist options
  • Save debreuil/c6fabb62636f709b0e51 to your computer and use it in GitHub Desktop.
Save debreuil/c6fabb62636f709b0e51 to your computer and use it in GitHub Desktop.
typealias Sig = (num:Int)->Int[]
var wrap:Sig = {(num:Int) in return [num]}
wrap(num:3) // [3]
wrap(num:4) // [4]
func numLog() -> Sig{
var log:Int[] = []
return {
log += $0
return log
}
}
let r = numLog()
r(num:2) // [2]
r(num:3) // [2,3]
r(num:4) // [2,3,4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment