fix: compute arguments to >> in correct order.

This commit is contained in:
Glen Whitney 2021-01-31 17:24:40 -08:00
parent a564b2274d
commit 132b8432e8
2 changed files with 9 additions and 6 deletions

View File

@ -8,7 +8,10 @@ signature
rules rules
js: TopLevel(x) -> $[const Stdio = { js: TopLevel(x) -> $[const Stdio = {
receives: v => { process.stdout.write(String(v)); return Stdio; }, receives: v => { process.stdout.write(String(v)); return Stdio; },
forwards: v => { process.stdout.write(String(v)); return v; } }
function forwards(data, strm) {
strm.receives(data);
return data;
} }
[x]] [x]]
@ -16,7 +19,7 @@ rules
js: Int(x) -> x js: Int(x) -> x
js: Sum(x) -> $[[x].reduce((v,w) => v+w)] js: Sum(x) -> $[[x].reduce((v,w) => v+w)]
js: Receives(x, y) -> $[[x].receives([y])] js: Receives(x, y) -> $[[x].receives([y])]
js: Enters(x, y) -> $[[y].forwards([x])] js: Enters(x, y) -> $[forwards([x],[y])]
jslist: x -> $<[<<join(|", ")>x>]> jslist: x -> $<[<<join(|", ")>x>]>

View File

@ -12,9 +12,9 @@ rules
def receives(self, v): def receives(self, v):
print(v, file=sys.stdout, end='') print(v, file=sys.stdout, end='')
return self return self
def forwards(self, v): def forwards(data,strm):
self.receives(v) strm.receives(data)
return v return data
Stdio = StdioC() Stdio = StdioC()
[x]] [x]]
@ -22,7 +22,7 @@ rules
py: Int(x) -> x py: Int(x) -> x
py: Sum(x) -> $[sum([x])] py: Sum(x) -> $[sum([x])]
py: Receives(x, y) -> $[[x].receives([y])] py: Receives(x, y) -> $[[x].receives([y])]
py: Enters(x, y) -> $[[y].forwards([x])] py: Enters(x, y) -> $[forwards([x],[y])]
pylist: x -> $<[<<join(|", ")>x>]> pylist: x -> $<[<<join(|", ")>x>]>