pyret-lang
pyret-lang copied to clipboard
nested tables do not copy well
Here's a program:
t = table: parent, sub
row: "A",
table: child
row: 1 row: 2 row: 3 row: 4
end
row: "B",
table: child
row: 5 row: 6 row: 7 row: 8
end
end
fun sum-list(l): for fold(sum from 0, i from l): sum + i end end
transform t using sub:
parent: sum-list(extract child from sub end)
end
Copying the resulting output produces:
parent sub
10 child1234
26 child5678
I understand it may be unclear what the exact output should be with nested tables (is that even a thing in T/CSV?), but I don't know if this output is ideal either. Indeed, one can imagine two forms of output, one of which preserves the nesting (which may not be purely T/CSV-compliant, but is still really useful for pasting into chat boxes), and the other of which is more T/CSV-compliant by constructing that uses joins to flatten out the nesting.
One can also imagine "value printing": producing the output as a table value, which can unambiguously be copied.