Are you planning to add linq_aggregate API for primitive types?
NSNumber* totalCount = [shoppingCart linq_aggregate: ^NSNumber*(id<MyCommodity> item, NSNumber* aggregate)
{
NSNumber* orderedItemsCount = [item numberOfOrders];
NSUInteger newResult = [orderedItemsCount unsignedIntegerValue] + [aggregate unsignedIntegerValue];
return @(newResult);
}];
In this example there is a lot of boxing/unboxing (NSNumber ==> NSUInteger ==> NSNumber) which is a good thing to avoid.
P.S. I know that integers can be "safely" casted to id. But I strongly dislike this approach. Moreover, it does not work for [NSNumber floatValue].
Are you planning to add
linq_aggregateAPI for primitive types?In this example there is a lot of boxing/unboxing (NSNumber ==> NSUInteger ==> NSNumber) which is a good thing to avoid.
P.S. I know that integers can be "safely" casted to
id. But I strongly dislike this approach. Moreover, it does not work for[NSNumber floatValue].