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 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 output of a method applied to each entry of the
original array (e.g. Python map())?

I can easily write 'for each' loops that do these and create mutable arrays,
and then return non-mutable copies, but I half expect that these are common
patterns, and there might be a nice, concise, way of writing them.

Are there any ObjC shortcuts when doing things like this? Am I best writing
a category on top of NSArray the encompass these (and other) patterns? I'd
like to retain ordering, so using NSSet for (1) seems counter productive.

Thanks

P.S. Alternatively, Is there a site like
http://aspn.activestate.com/ASPN/Cookbook/Python/ for Objective C?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to