mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
Recur through pairs of equal-length indexed terms.
This commit is contained in:
parent
8680bb4165
commit
52c1b581c6
@ -23,6 +23,16 @@ public struct Interpreter<Term: TermType> {
|
|||||||
switch algorithm {
|
switch algorithm {
|
||||||
case let .Pure(diff):
|
case let .Pure(diff):
|
||||||
return diff
|
return diff
|
||||||
|
|
||||||
|
case let .Roll(.Recursive(a, b, f)):
|
||||||
|
switch (a.unwrap, b.unwrap) {
|
||||||
|
case let (.Indexed(a), .Indexed(b)) where a.count == b.count:
|
||||||
|
return recur(f(.Indexed(zip(a, b).map(run))))
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user