Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 40b1254016
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (28 sloc) 0.572 kb
PfuncRewrite : FilterPattern {
var <>func, <>levels;
*new {|pattern, func, levels=1|
func = func ? {|in| [in]};
^super.new(pattern).func_(func).levels_(levels);
}
embedInStream {|event|
var stream, value;
stream = pattern.asStream;
stream.do {|value|
this.prProcess([value], levels);
};
^event;
}
prProcess {|inVal, level|
(level <= 0).if({
inVal.do {|val|
val.yield;
};
}, {
inVal.do {|val|
val = func.value(val);
(val.isKindOf(Collection).not).if { val = [val];};
this.prProcess(val, level-1);
};
});
}
}
Jump to Line
Something went wrong with that request. Please try again.