0
@@ -26,13 +26,15 @@ limitations under the License.
0
@discussion This class implements methods that act on enumerated collections of objects.
0
It is designed to be mixed into a class using the include method that Nu adds to NSObject.
0
The receiving class must have an objectEnumerator method that returns an NSEnumerator.
0
+ Some methods in this class take a callable object as an argument; callable objects are those
0
+ that have evalWithArguments:context: defined.
0
@interface NuEnumerable : NSObject
0
-/*! Iterate over each member of a collection, evaluating the provided block for each member. */
0
-- (id) each:(NuBlock *) block;
0
+/*! Iterate over each member of a collection, evaluating the provided callable item for each member. */
0
+- (id) each:(id) callable;
0
/*! Iterate over each member of a collection, evaluating the provided block for each member.
0
The block is expected to take two arguments: the member and its index. */
0
- (id) eachWithIndex:(NuBlock *) block;
0
@@ -41,12 +43,11 @@ limitations under the License.
0
/*! Iterate over each member of a collection, returning the first element for which the provided block evaluates non-nil. */
0
- (id) find:(NuBlock *) block;
0
/*! Iterate over each member of a collection, applying the provided block to each member, and returning an array of the results. */
0
-- (NSArray *) map:(NuBlock *) block;
0
-/*! Iterate over each member of a collection, using the provided block to combine members into a single return value.
0
- The block is expected to take two arguments: the accumulated return value followed by the collection member.
0
+- (NSArray *) map:(id) callable;
0
+/*! Iterate over each member of a collection, using the provided callable to combine members into a single return value.
0
-- (id) reduce:(
NSObject *) callable from:(id) initial;
0
+- (id) reduce:(
id) callable from:(id) initial;
0
/*! Iterate over each member of a collection, applying the provided selector to each member, and returning an array of the results. */
0
- (NSArray *) mapSelector:(SEL) selector;
Comments
No one has commented yet.