第一大类:
merge,for/merge
concat,for/concat
zip,join/zipWith 打包元组+reduce解包
combineLatest,join/combineLatestWith 打包元祖+reduce解包
第二大类:
map --> 自动对block返回的值加上class return 即升高维度的操作。
flattenMap --> 不对block返回值的附加操作。仅判断如果是空转化为class empty其实就是降维了
flatten: --> 降到指定维度
flatten --> 降维
bind
// mapReplace-> map (class return:block(value))-> flattenMap(block(value)) -> bind
flatten (value) ->
- (__kindof RACStream *)flattenMap:(__kindof RACStream * (^)(id value))block {
Class class = self.class;
return [[self bind:^{
return ^(id value, BOOL *stop) {
id stream = block(value) ?: [class empty];
NSCAssert([stream isKindOfClass:RACStream.class], @"Value returned from -flattenMap: is not a stream: %@", stream);
return stream;
};
}] setNameWithFormat:@"[%@] -flattenMap:", self.name];
}
- (__kindof RACStream *)flatten {
return [[self flattenMap:^(id value) {
return value;
}] setNameWithFormat:@"[%@] -flatten", self.name];
}
- (__kindof RACStream *)map:(id (^)(id value))block {
NSCParameterAssert(block != nil);
Class class = self.class;
return [[self flattenMap:^(id value) {
return [class return:block(value)];
}] setNameWithFormat:@"[%@] -map:", self.name];
}
- (__kindof RACStream *)mapReplace:(id)object {
return [[self map:^(id _) {
return object;
}] setNameWithFormat:@"[%@] -mapReplace: %@", self.name, RACDescription(object)];
}