Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

add reduce for basic types #184

Closed
wants to merge 1 commit into from
Closed

Conversation

AndyChenW
Copy link
Contributor

add basic type reduce support.

}];

*/
- (NSInteger)reduceInt:(NSInteger)initial WithBlock:(BKAccumulationBlockInt)block;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason the w in with is capitalized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I will fix it.

2013/12/1 segiddins notifications@github.com

In BlocksKit/NSArray+BlocksKit.h:

  • NSArray *peoples = @[p1, p2, p3];
  • int totalAge = 0;
  • for (People *people in peoples) {
  • totalAge += [people age];
  • }
    +
  • We can use block to make it better:
    +
  • NSArray *peoples = @[p1, p2, p3];
  • int totalAge = [peoples reduceInt:0 WithBlock:^int(NSInteger result, id obj, NSInteger index) {
  • return result + [obj age];
  • }];
    +
  • */
    +- (NSInteger)reduceInt:(NSInteger)initial WithBlock:(BKAccumulationBlockInt)block;

any reason the w in with is capitalized?


Reply to this email directly or view it on GitHubhttps://github.com/pandamonia/BlocksKit/pull/184/files#r8011548
.

陈育龙 移动端负责人, ELEME Inc.
Email:andy.chen@ele.me | Mobile: 86+159-2154-3125
http://ele.me 饿了么?

@AndyChenW
Copy link
Contributor Author

@segiddins it's done, thanks.

@segiddins
Copy link
Contributor

Also, could you rename int to integer since you're using NSInteger?

@AndyChenW
Copy link
Contributor Author

ok.

@AndyChenW
Copy link
Contributor Author

@segiddins done. thanks.

@AndyChenW
Copy link
Contributor Author

@segiddins anything else to be refactored?

@AndyChenW
Copy link
Contributor Author

@pandamonia

@zwaldowski zwaldowski closed this Dec 16, 2013
@AndyChenW
Copy link
Contributor Author

@zwaldowski I don't know why it is closed instead of merged.

@a2
Copy link
Collaborator

a2 commented Dec 16, 2013

This was merged. See 0cc231f.

@AndyChenW
Copy link
Contributor Author

thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants