Created
February 20, 2012 19:06
-
-
Save tralamazza/1870771 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| NSMutableArray* yay = [NSMutableArray new]; | |
| [yay addObject:@"1"]; | |
| [yay addObject:@"2"]; | |
| [yay addObject:@"3"]; | |
| NSNumber* reduced = [yay reduce:[NSNumber numberWithInt:0] block:^id(id sum, id i) { | |
| return [NSNumber numberWithInt:[sum intValue] + [i intValue]]; | |
| }]; | |
| STAssertEquals([reduced intValue], 6, @"whut?!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment