Implement inside/outside
This commit is contained in:
parent
a8d676641b
commit
aca3bea56b
2 changed files with 32 additions and 4 deletions
|
|
@ -696,6 +696,14 @@ export class Pattern {
|
|||
return this._fast(Fraction(1).div(factor));
|
||||
}
|
||||
|
||||
_inside(factor, f) {
|
||||
return f(this._slow(factor))._fast(factor);
|
||||
}
|
||||
|
||||
_outside(factor, f) {
|
||||
return f(this._fast(factor))._slow(factor);
|
||||
}
|
||||
|
||||
_ply(factor) {
|
||||
return this.fmap((x) => pure(x)._fast(factor))._squeezeJoin();
|
||||
}
|
||||
|
|
@ -1400,6 +1408,14 @@ Pattern.prototype.compress = function (...args) {
|
|||
args = args.map(reify);
|
||||
return patternify2(Pattern.prototype._compress)(...args, this);
|
||||
};
|
||||
Pattern.prototype.outside = function (...args) {
|
||||
args = args.map(reify);
|
||||
return patternify2(Pattern.prototype._outside)(...args, this);
|
||||
};
|
||||
Pattern.prototype.inside = function (...args) {
|
||||
args = args.map(reify);
|
||||
return patternify2(Pattern.prototype._inside)(...args, this);
|
||||
};
|
||||
|
||||
// call this after all Patter.prototype.define calls have been executed! (right before evaluate)
|
||||
Pattern.prototype.bootstrap = function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue