Created
June 7, 2014 00:47
-
-
Save debreuil/c6fabb62636f709b0e51 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
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