• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Obj-C idioms for list based tasks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obj-C idioms for list based tasks


  • Subject: Re: Obj-C idioms for list based tasks
  • From: Erik Buck <email@hidden>
  • Date: Mon, 7 Apr 2008 10:51:33 -0700 (PDT)

This is a prime use for Higher Order messaging:
http://www.metaobject.com/papers/Higher_Order_Messaging_OOPSLA_2005.pdf
 http://www.cocoadev.com/index.pl?HigherOrderMessaging
http://www.oreilly.com/pub/a/mac/2004/07/16/hom.html

HOM takes this

// which of these employee objects earn more than 1000 Euros.
int i;
id salariedEmployees = [NSMutableArray array];
for (i = 0 ; i < [employees count] ; i++ )
{
   id employee = [employees objectAtIndex: i ];
   if ( [employee hasSalary: 1000] )
   {
      [salariedEmployees addObject: employee];
   }
}

and turns it into this

salaried=[[employees select] hasSalary: 1000] ;

_______________________________________________

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

  • Prev by Date: Re: ImageIO key properties
  • Next by Date: Re: Southern California Coders? (Cocoaheads carpool)
  • Previous by thread: Re: Obj-C idioms for list based tasks
  • Next by thread: How inspect pending performSelectorOnMainThread ?
  • Index(es):
    • Date
    • Thread