discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Filter array using NSPredicate


From: Koh Nyap-Hong
Subject: Re: Filter array using NSPredicate
Date: Tue, 5 Oct 2010 16:58:17 +0800

Hi,

I prefer the HOM approach, more OO-ish. I will try it up. Thanks for the info.


On Tue, Oct 5, 2010 at 2:44 AM, Niels Grewe <niels.grewe@halbordnung.de> wrote:
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)

Cheers,


Niels

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


reply via email to

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