Re: Use of blocks
Re: Use of blocks
- Subject: Re: Use of blocks
- From: Giannandrea Castaldi <email@hidden>
- Date: Mon, 12 Jul 2010 17:59:22 +0200
Yes, as already suggested by Preston, key path operators are very expressive.
Thanks for the suggestions.
Jean
On Mon, Jul 12, 2010 at 4:31 PM, Keith Duncan <email@hidden> wrote:
>> overkill. You can get less, faster code by using a for/in loop:
>>
>> float minValue = INFINITY;
>> for(id obj in someTrips)
>> minValue = MIN(minValue, [[obj adultFinalPrice] floatValue]);
>
> You could get even less, more expressive code, using key path operators:
>
> NSNumber *minValue = [someTrips valueForKeyPath:@"@min.adultFinalPrice"];
> NSNumber *maxValue = [someTrips valueForKeyPath:@"@max.adultFinalPrice"];
>
> Keith
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
“We are what we repeatedly do. Excellence then, is not an act, but a habit.”
Aristotle
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden