1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Recur into indexed terms of equal length.

This commit is contained in:
Rob Rix 2015-10-09 20:24:39 -04:00
parent 962e3fda24
commit d0ee908d54

View File

@ -90,6 +90,9 @@ public enum Algorithm<A, B> {
if Term.equals(equals)(a, b) { return f(Diff(b)).evaluate(equals, recur: recur) }
switch (a.out, b.out) {
case let (.Indexed(a), .Indexed(b)) where a.count == b.count:
return f(.Indexed(zip(a, b).map(recur))).evaluate(equals, recur: recur)
default:
// This must not call `recur` with `a` and `b`, as that would infinite loop if actually recursive.
return f(Diff.Pure(.Replace(a, b))).evaluate(equals, recur: recur)