1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 11:02:26 +03:00

Use costOfStream to implement cons.

This commit is contained in:
Rob Rix 2015-10-06 11:57:37 -04:00
parent 1ac2f8d8c0
commit 28d5612c44

View File

@ -119,7 +119,7 @@ public enum FreeAlgorithm<A, B> {
}
func cons(diff: Diff, rest: Memo<Stream<(Diff, Int)>>) -> Stream<(Diff, Int)> {
return .Cons((diff, cost(diff) + (rest.value.first?.1 ?? 0)), rest)
return .Cons((diff, cost(diff) + costOfStream(rest)), rest)
}
func costOfStream(stream: Memo<Stream<(Diff, Int)>>) -> Int {