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

Write cost as a func.

This commit is contained in:
Rob Rix 2015-10-06 11:55:15 -04:00
parent cc6627bb52
commit 84a1122ed7

View File

@ -105,8 +105,8 @@ public enum FreeAlgorithm<A, B> {
if a.isEmpty { return f(b.map { Diff.Pure(Patch.Insert($0)) }).evaluate(equals) }
if b.isEmpty { return f(a.map { Diff.Pure(Patch.Delete($0)) }).evaluate(equals) }
let cost: Diff -> Int = { diff in
diff.map(const(1)).iterate { syntax in
func cost(diff: Diff) -> Int {
return diff.map(const(1)).iterate { syntax in
switch syntax {
case .Leaf:
return 0