mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 13:08:28 +00:00
rename inner <> outer bind and join
This commit is contained in:
parent
ac5c844f0b
commit
8ea59067ce
@ -563,18 +563,8 @@ class Pattern {
|
|||||||
return this.bind(id);
|
return this.bind(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
innerBind(func) {
|
|
||||||
return this._bindWhole((a, _) => a, func);
|
|
||||||
}
|
|
||||||
|
|
||||||
innerJoin() {
|
|
||||||
// Flattens a pattern of patterns into a pattern, where wholes are
|
|
||||||
// taken from inner events.
|
|
||||||
return this.innerBind(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
outerBind(func) {
|
outerBind(func) {
|
||||||
return this._bindWhole((_, b) => b, func);
|
return this._bindWhole((a, _) => a, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
outerJoin() {
|
outerJoin() {
|
||||||
@ -583,6 +573,16 @@ class Pattern {
|
|||||||
return this.outerBind(id);
|
return this.outerBind(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
innerBind(func) {
|
||||||
|
return this._bindWhole((_, b) => b, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
innerJoin() {
|
||||||
|
// Flattens a pattern of patterns into a pattern, where wholes are
|
||||||
|
// taken from inner events.
|
||||||
|
return this.innerBind(id);
|
||||||
|
}
|
||||||
|
|
||||||
squeezeJoin() {
|
squeezeJoin() {
|
||||||
const pat_of_pats = this;
|
const pat_of_pats = this;
|
||||||
function query(state) {
|
function query(state) {
|
||||||
@ -633,7 +633,7 @@ class Pattern {
|
|||||||
args = args.map((arg) => (isPattern(arg) ? arg.fmap((value) => value.value || value) : arg));
|
args = args.map((arg) => (isPattern(arg) ? arg.fmap((value) => value.value || value) : arg));
|
||||||
const pat_arg = sequence(...args);
|
const pat_arg = sequence(...args);
|
||||||
// arg.locations has to go somewhere..
|
// arg.locations has to go somewhere..
|
||||||
return pat_arg.fmap((arg) => func.call(pat, arg)).outerJoin();
|
return pat_arg.fmap((arg) => func.call(pat, arg)).innerJoin();
|
||||||
};
|
};
|
||||||
return patterned;
|
return patterned;
|
||||||
}
|
}
|
||||||
@ -1126,20 +1126,20 @@ const patternify2 = (f) => (pata, patb, pat) =>
|
|||||||
pata
|
pata
|
||||||
.fmap((a) => (b) => f.call(pat, a, b))
|
.fmap((a) => (b) => f.call(pat, a, b))
|
||||||
.appLeft(patb)
|
.appLeft(patb)
|
||||||
.outerJoin();
|
.innerJoin();
|
||||||
const patternify3 = (f) => (pata, patb, patc, pat) =>
|
const patternify3 = (f) => (pata, patb, patc, pat) =>
|
||||||
pata
|
pata
|
||||||
.fmap((a) => (b) => (c) => f.call(pat, a, b, c))
|
.fmap((a) => (b) => (c) => f.call(pat, a, b, c))
|
||||||
.appLeft(patb)
|
.appLeft(patb)
|
||||||
.appLeft(patc)
|
.appLeft(patc)
|
||||||
.outerJoin();
|
.innerJoin();
|
||||||
const patternify4 = (f) => (pata, patb, patc, patd, pat) =>
|
const patternify4 = (f) => (pata, patb, patc, patd, pat) =>
|
||||||
pata
|
pata
|
||||||
.fmap((a) => (b) => (c) => (d) => f.call(pat, a, b, c, d))
|
.fmap((a) => (b) => (c) => (d) => f.call(pat, a, b, c, d))
|
||||||
.appLeft(patb)
|
.appLeft(patb)
|
||||||
.appLeft(patc)
|
.appLeft(patc)
|
||||||
.appLeft(patd)
|
.appLeft(patd)
|
||||||
.outerJoin();
|
.innerJoin();
|
||||||
|
|
||||||
Pattern.prototype.echo = function (...args) {
|
Pattern.prototype.echo = function (...args) {
|
||||||
args = args.map(reify);
|
args = args.map(reify);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user