Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


This is obsolete and unmaintained. Don’t use it! Use Reducers or ReactiveCocoa or Swift instead.


Lazily-evaluated (when feasible) higher-order functions for Cocoa collections (including your own), with as little chaff as possible.

In short:

#import <RXCollections/RXCollections.h>

RXMap(people, ^(Pal *each) { return each.phoneNumber; });

RXFilter(ungulates, ^(id<Ungulate> each) { return each.stomachCount == 4; });

RXFold(chunksOfText, @"", ^(NSString *full, NSString *each) { return [full stringByAppendingString:each]; });

RXLinearSearch(scientists, ^bool(Scientist *each, bool *stop) { return [ isEqualToString:@"Richard Feynman"]; });

RXConvolveWith(@[names, addresses, phoneNumbers], ^(NSUInteger count, id const objects[count]) {
	return [BusinessCard withName:objects[0] address:objects[1] phoneNumber:objects[2]];

(Yeah, yeah, you can call it RXZipWith instead if you like that so much better.)

Collections that can be created

Maps and filters return enumerations, which can be made into concrete collections with the RXConstruct… functions, e.g. RXConstructArray(RXMap(…)). It doesn’t matter what you’re mapping or filtering if you’re constructing a set or array; constructing dictionaries, however, requires the enumeration to produce RXKeyValuePair-conformant objects so that it can associate the keys and values it inserts.

Collections that can be traversed

RXMap, RXFold, RXFilter, RXLinearSearch can traverse anything conforming to NSFastEnumeration (which includes, among other things, NSEnumerator and NSManagedObjectModel). The returned object can itself be enumerated, as well as composed with other traversals safely and cleanly.


  • Maps, filters, and convolutions are lazily evaluated. RXConstructArray lazily constructs an array from its source enumeration.

  • More documentation is available in the header files.

  • The included Xcode target compiles a framework and a dylib, but you can also just link the source files in.


  • Depth-first tree traversals with prefix/infix/postfix ordering. As a corollary, removing RXRecursiveEnumerator.

  • Concatenation of traversals.

  • Combined RXConstruct… and RXMap/RXFilter shorthands, e.g. RXMapToArray()?