This is a good question. I think both of them are suitable for various problems. Nested vectors are a good solution if each node can contain a variable set of information - in particular, template systems will work well. Entries are a good solution for a small number of fixed node types, where nesting is much more limited.
We work a lot with heterogeneous record trees. Each node is one of several known types, each of which has a different set of known fixed keys. In this case, the reason entries are better, since you can select data from node by key, which is O (1) (actually the Java method call is very fast), and not O (n) (where you have to view the contents of node ), and it’s also usually easier to access.
The entries in 1.2 are imho not quite “finished,” but it's pretty easy to compile this stuff yourself. We have defrecord2 , which adds constructor functions (new-foo), field validation, print support, print support, tree navigation support / editing through lightning, etc.
An example of where we use this is to represent AST or execution plans, where nodes can be like Join, Sort, etc.
Vectors will be better at creating things like strings where you can place an arbitrary number of things on each node. If you can fill out 1+ <s> inside the <div>, then you cannot create a record containing the field: p, which just doesn't make any sense. This is the case when vectors are much more flexible and idiomatic.
Alex miller
source share