1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Document the Recursive operation a little.

This commit is contained in:
Rob Rix 2015-10-07 13:28:16 -04:00
parent 06c456f1cd
commit 0ad285fb26

View File

@ -84,6 +84,9 @@ public enum Algorithm<A, B> {
return b
case let .Roll(.Recursive(a, b, f)):
// Recur structurally into both terms, if compatible, patching paired sub-terms. This is akin to the shape of unification, except that it computes a patched tree instead of a substitution. Its also a little like a structural zip on the pair of terms.
//
// At the moment, there are no restrictions on whether terms are compatible, and there is no structure to exploit in terms; therefore, this simplifies to copying if equal, and replacing otherwise.
return f(Term.equals(equals)(a, b)
? Diff(b)
// This must not call `recur` with `a` and `b`, as that would infinite loop if actually recursive.