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

Recurrence checks for equality.

This commit is contained in:
Rob Rix 2015-10-06 16:59:29 -04:00
parent a1a832012e
commit c2d4c96d62

View File

@ -41,6 +41,11 @@ public func SES<A>(a: [Fix<A>], _ b: [Fix<A>], equals: (A, A) -> Bool, recur: (F
func copy(term: Term) -> Diff {
return Diff.Roll(term.out.map(copy))
}
let recur = {
Fix.equals(equals)($0, $1)
? copy($1)
: recur($0, $1)
}
if let right = right, down = down, diagonal = diagonal {
let costs = (right: costOfStream(right), down: costOfStream(down), diagonal: costOfStream(diagonal))