[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filter array using NSPredicate

From: Niels Grewe
Subject: Re: Filter array using NSPredicate
Date: Mon, 4 Oct 2010 20:44:08 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Oct 05, 2010 at 12:07:33AM +0800, Koh Nyap-Hong wrote:
> Yes, basically what I want to do with NSPredicate can actually achieved using
> the traditionally way of while/for loop. However I was recently impressed by
> functional programming way of filtering array/list, I would like to try the
> declarative way of filtering array (I know NSPredicate way of filtering is
> actually just kind of declarative).

I don't know if this really fits your bill, but if you're just looking
for a concise way of manipulating collections, you could also try out
the higher-order messaging APIs in EtoileFoundation [0], which allow you
to do stuff like this:

[[pitches filter] isEqualToString: @"Do"];
[[[pitches filter] description] isEqualToString: @"Do"];

(Note that this requires pitches to be a mutable collection)



[0] http://svn.gna.org/svn/etoile/trunk/Etoile/Frameworks/EtoileFoundation

reply via email to

[Prev in Thread] Current Thread [Next in Thread]