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
enum Either<A, B> { | |
case Left(A) | |
case Right(B) | |
} | |
func isLeft<A,B>(it : Either<A,B>) -> Bool { | |
switch it { case .Left: return true; case .Right: return false } | |
} | |
func isRight<A,B>(it : Either<A,B>) -> Bool { |
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
Note that like all analogies, this is not a perfect one. I find it helps me think about it though. Also, don't try to draw conclusions about performance from this analogy :) | |
-[NSUserDefaults setObject:forKey:] is like... | |
<edit file to add key and value> | |
git add file | |
git commit | |
dispatch_after(some time, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
[[NSUserDefaults standardUserDefaults] synchronize] | |
}); |