3 ms·
> Sequences, trees and graphs are core abstractions to most programming, why try to flatten all trees and graphs to sequences? Because "trees" and "graphs" are
by lmm 2y ago
> Sequences, trees and graphs are core abstractions to most programming, why try to flatten all trees and graphs to sequences?
Because "trees" and "graphs" aren't actually single concepts, they're families of concepts that can vary along many dimensions. Most programming languages offer one or a small handful of sequence types, because most sequence use patterns are the same. Most languages don't offer a tree or graph type, and as soon as you try to implement one you see why: there are multiple different kinds of trees and graphs, and multiple different representations that are appropriate for different use cases, and any one you might pick would be unsuitable for most programs people want to write.
- naasking 2y ago> Most languages don't offer a tree or graph type, and as soon as you try to implement one you see why: there are multiple different kinds of trees and graphs, and multiple different representations that are appropriate for different use cases I think it's more because the abstract interfaces for trees and graphs that can support multiple representations aren't as well known [1]. An iterator/sequence interface has a simple abstract structure that everyone immediately understands, but the structure needed to abstract over graphs and trees are trickier. [1] https://www.cs.tufts.edu/~nr/cs257/archive/andrey-mokhov/algebraic-graphs.pdf https://www.cs.tufts.edu/~nr/cs257/archive/andrey-mokhov/alg...