From the Common Lisp HyperSpec glossary:
tree n. 1. a binary recursive data structure made up of conses and atoms: the conses are themselves also trees (sometimes called "subtrees" or "branches"), and the atoms are terminal nodes (sometimes called leaves). Typically, the leaves represent data while the branches establish some relationship among that data. 2. in general, any recursive data structure that has some notion of "branches" and leaves.
tree structure n. (of a tree) the set of conses that make up the tree. Note that while the car[1b] component of each such cons is part of the tree structure, the objects that are the cars of each cons in the tree are not themselves part of its tree structure unless they are also conses.
The last sentence in the definition of tree structure raises a question, which is, can the same be said about cdrs too?
Use of the word binary in the definition of "tree" seems to suggest that there is no difference between car vs cdr for the purposes of trees, but then the definition of "tree structure" seems to treat cars special, so I am confused.
Short answer
I think the answer is "yes." There's a similar definition for list structure with almost identical wording. There's more potential for confusion about in list structure about whether the value of a car of a cons is part of the list structure, since questions can aris about, e.g., "what does it mean to replace X in the list (X (X) Y)?" The cdr isn't really in question much, since the cdr is the rest of the list; it's sort of obviously part of the list structure.
For tree structure, I think that there's less ambiguity; cons in the car or the cdr is a subtree. The definitions of tree structure and list structure are almost identical in places, and I wouldn't be surprised if someone wrote the definition for list structure, and then copied it for tree structure, making the minimal number of changes necessary to be accurate. That would leave the bit about cars in there, even though the question that it answers probably wouldn't arise in practice.
Longer answer
Let's look at the definition of list structure and compare:
Note the specific places where these differ:
That means that in
there are three cons cells in the list structure, and four cons cells in the tree structure.
Where does this actually matter? It becomes important to define these terms precisely so that the specification can easily define what parts of a list or tree are traversed or modified by particular functions.
nsubst can modify tree structure
For instance, the functions nsubst and friends, whose documentation states:
A specific definition of tree structure allows us to understand what things may and may not be changed by nsubst.
So, what this is telling us is that for any cons cell x in the tree, nsubst might do (setf (car x) …), so that the (car x) might be something different later on, but it won't modify the actual object that would be returned by (car x) (unless it's a cons, of course). This could be important in cases where the value of (car x) is an object that might have trees inside of it. So for instance, nsubst won't descend into vectors, but it will replace vectors:
delete-duplicates can modify list structure
On the other hand delete-duplicates will only modify list structure:
As far as I can see, author of this definition tries to draw the line between sturcture of tree itself and its objects. So it states that only conses can make up structure of tree.
Consider this example:
While object
"string"
is part of the tree (and it iscar
of("string")
), it is not part of tree structure, because strings don't consist of cons cells.I suppose author of the definition had in mind proper lists, because for them every element is
car
:cdr
rather defines structure of tree in case of proper list.But you also could consider the following as tree:
In this case
cdr
would not be part of tree structure.