4 ms·
> How would you represent a tree or graph data structure in text to a human and let them manipulate it? Tree: '(root (left (left-left left-right)) (right
by wtbob 11y ago
> How would you represent a tree or graph data structure in text to a human and let them manipulate it?
Tree:
'(root (left (left-left left-right)) (right (right-left right-right)))
Graph:
'(graph (#1=node1 #2=node2) (#2# #3=node3) (#3# #1#))
Solved problems since at least the early 90s.
> Yet using it to paint is a lot harder.
Sure, but drawing is only one activity among many possible activities.
> As a software developer you're often manipulating only text.
I think that's true for most users: they are reading articles (text); writing comments (text); sending social updates (rich text); watching videos (not text); playing games (not text, but may have textual content, e.g. in-game chat).
- swhipple 11y agoI'm not really convinced S-exprs are particularly good examples of representing trees and graphs to humans while expecting them to be as easily readable and writable as the graphical forms. You lose spatial intuition with this representation. You could make up for it on small trees somewhat with indentation and vertical spacing, but you'd lose it again for larger trees and graphs. We don't pictorially represent our trees like this [1], for instance, which is roughly how the S-exprs visually appear. When I author graphs in LaTeX, it is often easier to run through a compilation cycle to see what the result looks like and which edits are needed, rather than mentally reasoning about the edges by looking at the code. [1] http://i.imgur.com/43Dc8YB.png http://i.imgur.com/43Dc8YB.png