robb/Asterism — pull request #46 by robb (2014-05-22 13:55:23+00:00)
Title: Add ASTChain

This adds `ASTChain`, a helper macro to reduce boilerplate in cases where intermediate results of a transformation would pollute the current scope.

E.g.

```objc
NSArray *messages = ASTPluck(tweets, @keypath(XYTweet.new, message));

NSArray *strings = ASTFilter(values, ^(id obj) {
return [obj isKindOfClass:NSString.class];
})

NSArray *result = ASTMap(values, ^(NSString *string) {
return string.resultString;
})

NSLog(@"%@", result);
```

could be replaced with

```objc
NSArray *result = ASTChain(
ASTPluck(tweets, @keypath(XYTweet.new, message)),
ASTFilter(_, ^(id obj) {
return [obj isKindOfClass:NSString.class];
}),
ASTMap(_, ^(NSString *string) {
return string.capitalizedString;
})
);

NSLog(@"%@", result);
```

removing the need for temporary `messages` and `strings` variables.

Would love to hear some opinions on this, since it may just be a little to much macro-magic…