Streaming spreadsheets

Darius JJ Chuck

2021-06-03

Streaming

In mathematical terms, TAO can be seen as a superset of the Dyck language.

Like the Dyck language, TAO is closed under the operation of concatenation.

This is an important property which has practical implications.

For example TAO lends itself very well to streaming, unlike syntaxes which do not have this property.

One such syntax is JSON where concatenating two objects or arrays does not produce a valid syntactical structure.

This can be worked around with various JSON streaming techniques such as ndjson or JSON Lines.

However having this property built into the syntax certainly makes life simpler.

Spreadsheets

An interesting example from the JSON Lines specification:

["Name", "Session", "Score", "Completed"]
["Gilbert", "2013", 24, true]
["Alexa", "2013", 29, true]
["May", "2012B", 14, false]
["Deloise", "2012A", 19, true] 

Can be translated to Data TAO:

[
[
Name
]
[
Session
]
[
Score
]
[
Completed
]
]
[
[
Gilbert
]
[
2013
]
[
24
]
[
true
]
]
[
[
Alexa
]
[
2013
]
[
29
]
[
true
]
]
[
[
May
]
[
2012B
]
[
14
]
[
false
]
]
[
[
Deloise
]
[
2012A
]
[
19
]
[
true
]
]

or with more readable formatting:

[
[
Name
]
[
Session
]
[
Score
]
[
Completed
]
]
[
[
Gilbert
]
[
2013
]
[
24
]
[
true
]
]
[
[
Alexa
]
[
2013
]
[
29
]
[
true
]
]
[
[
May
]
[
2012B
]
[
14
]
[
false
]
]
[
[
Deloise
]
[
2012A
]
[
19
]
[
true
]
]

Is it just me or does it look a lot like a spreadsheet?

Interestingly, if we drop Data TAO compliance (but still maintain TAO compliance) this can be compacted even more. For example:

[Name`,Session`,Score`,Completed]
[Gilbert`,2013`,24`,true]
[Alexa`,2013`,29`,true]
[May`,2012B`,14`,false]
[Deloise`,2012A`,19`,true]

or even:

Name`,Session`,Score`,Completed`;Gilbert`,2013`,24`,true`;Alexa`,2013`,29`,true`;May`,2012B`,14`,false`;Deloise`,2012A`,19`,true`;

If we unescape the commas and replace `; with new lines we get CSV. Except TAO is much more generic, elegant, and powerful.