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:
parent
cc6627bb52
commit
84a1122ed7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user