Re: Obj-C idioms for list based tasks

2008-04-07 Thread Erik Buck
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 10

Re: Obj-C idioms for list based tasks

2008-04-07 Thread John Stiles
Cocoa doesn't have ordered sets. It has arrays (NSArray), unordered sets (NSSet), and unordered key-value tables (NSDictionary). Any of these can optionally be mutable. NSCountedSet also allows for the equivalent of a "multiset," but for some reason there is no NSCountedDictionary, for the equi

Re: Obj-C idioms for list based tasks

2008-04-07 Thread Jake Carter
You may also want to look in to NSPredicate and an arrays 'filteredArrayUsingPredicate:' method. http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSPredicate_Class/Reference/NSPredicate.html http://theocacao.com/document.page/346 http://developer.apple.com/documentati

Re: Obj-C idioms for list based tasks

2008-04-07 Thread William Turner
On Apr 7, 2008, at 5:33 AM, Paul Sargent wrote: Can anybody suggest a good way to: 1) Given an ordered set of objects, create a new non-mutable ordered set, with all the duplicates removed? You could do this using the KVC set and array operators (http://developer.apple.com/documentation/C

Re: Obj-C idioms for list based tasks

2008-04-07 Thread Jens Alfke
On 7 Apr '08, at 5:33 AM, Paul Sargent wrote: Can anybody suggest a good way to: 1) Given an ordered set of objects, create a new non-mutable ordered set, with all the duplicates removed? 2) Given an ordered set of objects, create a new non-mutable ordered set, with each entry being the o

Obj-C idioms for list based tasks

2008-04-07 Thread Paul Sargent
Coming from other object based languages I'm aware that each language can have it's own idioms for common tasks. In particular coming from doing a lot of python, I'm finding myself wanting to do a few things with NSArrays that I would do quite easily with python lists. Can anybody suggest a good w