Functional operations for Obj-C collections
Funcussion is a library for doing functional operations on Objective C collections (NSArray and NSDictionary). You can count on collection operations to be curried (return another collection) and can expect lots of sugar syntax for improving the experience of manipulating these collections.
Here's some example syntax:
[@[@20,@22] reduceWithAccumulator:@0 andBlock:^id(id acc, id obj) {
return [NSNumber numberWithInt:[acc intValue] + [obj intValue]];
}];
You'll also have access to concise iterators(each:
,eachWithIndex:
) , standard functional operations (map:
,filter:
,detect:
) and some more utilitarian methods (detect:
,every:
,any:
,max:
,min:
).
You can learn more about the library and it's capabilities by perusing the README.
Written by Stephen Caudill
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ios
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#