feat: Implement enters operator >> #8
@ -8,7 +8,10 @@ signature
|
||||
rules
|
||||
js: TopLevel(x) -> $[const 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]]
|
||||
|
||||
@ -16,7 +19,7 @@ rules
|
||||
js: Int(x) -> x
|
||||
js: Sum(x) -> $[[x].reduce((v,w) => v+w)]
|
||||
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>]>
|
||||
|
||||
|
@ -12,9 +12,9 @@ rules
|
||||
def receives(self, v):
|
||||
print(v, file=sys.stdout, end='')
|
||||
return self
|
||||
def forwards(self, v):
|
||||
self.receives(v)
|
||||
return v
|
||||
def forwards(data,strm):
|
||||
strm.receives(data)
|
||||
return data
|
||||
Stdio = StdioC()
|
||||
[x]]
|
||||
|
||||
@ -22,7 +22,7 @@ rules
|
||||
py: Int(x) -> x
|
||||
py: Sum(x) -> $[sum([x])]
|
||||
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>]>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user