Should the description of the equal? predicate include a reference and/or more details on the unfolding of arguments into regular trees?
The R6RS uses the following wording:
The equal? predicate treats pairs and vectors as nodes with outgoing edges
That wording is more precise and I would support adding it to the description. I would also support a citation to Adam's and Dybvig's paper for an algorithm.
@phm wrote in #329 (comment):
The R6RS uses the following wording:
The equal? predicate treats pairs and vectors as nodes with outgoing edges
That wording is more precise and I would support adding it to the description. I would also support a citation to Adam's and Dybvig's paper for an algorithm.
I think the confusion stems from the wording "ordered tree" and "regular tree", which appears to be a term from automata theory. However, I couldn't find a good explanation on internet.
A tree is called ordered if there is an order among the successors of each of its nodes. The above definition of tree naturally suggests an order among the successors, which can be used to make the tree ranked.
https://en.wikipedia.org/wiki/Tree_(graph_theory)
Can someone find out the source reference of the definitions of these terms?
On the other hand, the rationale behind the definition is quite intuitive. It basically says the implementation of equal? should use some memorization technique to prevent recursive calling equal? being stuck on infinite loop. Maybe there's other way to formalize this intuition in spec.
@readevalprintloop wrote in #329 (comment):
I think the confusion stems from the wording "ordered tree" and "regular tree", which appears to be a term from automata theory. However, I couldn't find a good explanation on internet.
The trees are certainly not "regular" in the sense of that Wikipedia article. The R7RS-Small just replaces it with "tree."
According to Bruno Courcelle (1983), "Fundamental Properties of Infinite Trees", a tree is regular if the set of its subtrees is finite. That makes sense, because a circular data structure will repeat and hence have a finite number of subtrees, so this probably the definition in mind.
I have reverted the text to the R7RS-Small's "into (possibly infinite) trees" instead of "regular trees." I think that referring to them as "regular" is likely to cause confusion than to help.
The precise definition is that equal? is the greatest equivalence relation such that the following holds: (equal? X Y) is true if and only if
XandYare non-pairs or non-vectors and are considered equal (which is defined earlier),XandYare both pairs whose cars and cdrs areequal?, respectively,XandYare both vectors of the same length whose corresponding elements areequal?.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?