3 ms·
How would you deal with a tree?
by nmz 3y ago
How would you deal with a tree?
- lelanthran 3y agoWho cares? It deals with 99.99% of uses cases that pipes are being used for right now. That's more than good enough. If you really needed to output a tree using only rs and fs characters, and since they are only a single byte each, you could cover that 1 in a 1000 use case by using empty fields for depth of a record, and attaching any record to the current parent until the depth changes.
- nmz 3y agoI care, I wrote a converter[1] for it a long time ago, when I wanted to write a json one I got stuck. Depth of a record seems useful, but then you'll have to make fields mandatory to indicate between real records and depth. slowing down the parsing. [1]: https://github.com/Nomarian/AsciiDT https://github.com/Nomarian/AsciiDT
- tejtm 3y agoNewick trees https://en.wikipedia.org/wiki/Newick_format https://en.wikipedia.org/wiki/Newick_format
- nmz 3y agoThat seems like a text format on its own? doesn't even use RS/FS. Even when Translating it uses { (),; } that's 4 characters to indicate a tree. Maybe you could use FS=, RS=; GS=( US=) Is that what you mean?