Nu Class Reference

NuEnumerable

The NuEnumerable mixin class.

Superclass: NSObject
Declared in: objc/Nu.h

This class implements methods that act on enumerated collections of objects. It is designed to be mixed into a class using the include method that Nu adds to NSObject. The receiving class must have an objectEnumerator method that returns an NSEnumerator. Some methods in this class take a callable object as an argument; callable objects are those that have evalWithArguments:context: defined.

Methods

- (NSArray *) mapSelector: (SEL) selector
Iterate over each member of a collection, applying the provided selector to each member, and returning an array of the results.

in objc/Nu.h

- (id) reduce: (id) callable
from: (id) initial
Iterate over each member of a collection, using the provided callable to combine members into a single return value.

in objc/Nu.h

- (NSArray *) map: (id) callable
Iterate over each member of a collection, applying the provided block to each member, and returning an array of the results.

in objc/Nu.h

- (id) find: (NuBlock *) block
Iterate over each member of a collection, returning the first element for which the provided block evaluates non-nil.

in objc/Nu.h

- (NSArray *) select: (NuBlock *) block
Iterate over each member of a collection, returning an array containing the elements for which the provided block evaluates non-nil.

in objc/Nu.h

- (id) eachWithIndex: (NuBlock *) block
Iterate over each member of a collection, evaluating the provided block for each member. The block is expected to take two arguments: the member and its index.

in objc/Nu.h

- (id) each: (id) callable
Iterate over each member of a collection, evaluating the provided callable item for each member.

in objc/Nu.h